Error: Cannot read properties of undefined (reading 'indexOf')
kumailn opened this issue · comments
Kumail Naqvi commented
I have a simple app setup as follows:
import { importQL } from 'https://deno.land/x/importql/mod.ts';
import { Application } from 'https://deno.land/x/oak@v12.1.0/mod.ts';
import { Router } from 'https://deno.land/x/oak@v6.0.1/mod.ts';
import { ObsidianRouter } from 'https://deno.land/x/obsidian/mod.ts';
import { resolvers } from './resolvers.ts';
const types = importQL('schema.graphql');
const PORT = 1111;
const app = new Application();
const router = new Router();
interface ObsRouter extends Router {
obsidianSchema?: any;
}
const GraphQLRouter = await ObsidianRouter<ObsRouter>({
Router,
typeDefs: types,
resolvers: resolvers,
useCache: true,
usePlayground: true,
context: (request) => {
return {
...request,
secret: request?.request?.headers?.get('apiKey'),
ip: request?.request?.headers?.get('x-forwarded-for') || request?.request?.ip,
referer: request?.request?.headers?.get('referer'),
};
},
});
app.use(router.routes(), router.allowedMethods());
app.use(GraphQLRouter.routes(), GraphQLRouter.allowedMethods());
await app.listen({
port: PORT,
});
When I run a simple query in my graphql playground such as
query getBook {
book(id:"1") {
id
}
}
I get an error Cannot read properties of undefined (reading 'indexOf')
. If I set useCache: false
then this error does not occur. Redis is running on the default port. Is there something wrong with my setup or is this a bug?