3

I have been using Apollo server for quite sometime now, and I have built a number of projects with it, but, recently I wanted to use it in conjunction with TypeScript, I finally got it to work after many trials, but I got stuck with Apollo Sandbox, it says:

Schema Introspection Failure: Introspection is disabled on this endpoint. Enable introspection to populate your schema.

The problem is I already have inspection turned on, this is my server configuration for your reference:

// Imports...

const protection = new ApolloArmor({
  // Some configs...
}).protect();

const server: ApolloServer = new ApolloServer({
  schema,
  // ...protection,
  debug: config.env.development,  // Currently "true"
  introspection: config.env.development,  // Currently "true"
  csrfPrevention: true,
  cache: "bounded",
  cors: {
    origin: [...config.globals.whiteListedIps],  // Currently "*"
  },
  plugins: [
    config.env.production  // Currently "false"
      ? ApolloServerPluginLandingPageProductionDefault()
      : ApolloServerPluginLandingPageLocalDefault({ embed: true }),
    ApolloServerPluginInlineTraceDisabled(),
  ],
  context: async ({ req }: { req: CustomRequest }) => {
    // some stuff...
  },
  dataSources: () => {
    // some stuff....
  },
  // Other configs...
});

export default server;

I'm using:

  • Node JS - v16.15.0
  • TypeScript - v4.8.3
  • ts-node-dev - v2.0.0
  • graphql - v16.6.0
  • apollo-server - v3.10.2
  • @apollo/subgraph - v2.1.2

I hope you can help me, thanks in advance

1 Answers1

0

Well, maybe your API is protected. You can go and check in the inspect network tab of any browser, and it will show the error. You have used "context", which I think is for authorization stuff and if you remove the context part it will probably be running fine (removing context is not the answer, but most probably the reason behind your error).