Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot read properties of undefined (reading 'indexOf') #78

Open
kumailn opened this issue Apr 17, 2023 · 0 comments
Open

Error: Cannot read properties of undefined (reading 'indexOf') #78

kumailn opened this issue Apr 17, 2023 · 0 comments

Comments

@kumailn
Copy link

kumailn commented Apr 17, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant