Gateway to Router - persistedQueries/cache


I’m working on migrating from gateway to router. I have router working at the moment with basic configuration, but I’m working on migrating some of our existing Apollo Server constructor configuration.

We were passing in the following parameters to ApolloServer:

csrfPrevention: true,
persistedQueries: false,
cache: 'bounded',
formatError: formatError


  • Can you confirm that csrlPrevention is set to true by default, so there’s no need to explicitly name it?
  • Is there a way to migrate persistedQueries and cache: bounded to Router?
  • We were also using “formatError” to pass in a custom error formatting function. Is there a way to migrate that to Router?



  all: true # Propagate errors from all subgraphs
    products: false # Do not propagate errors from the products subgraph

A custom Rhai script would be able to do whatever else you needed in addition to the error formating.

If you want to chat more about your migration, you can join us in our Discord server and ping me (@watson). Hope to see you there!