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

validationRule not working even when setting cache to false #533

Open
benjaminIDruide opened this issue Jul 13, 2021 · 2 comments
Open

validationRule not working even when setting cache to false #533

benjaminIDruide opened this issue Jul 13, 2021 · 2 comments

Comments

@benjaminIDruide
Copy link

benjaminIDruide commented Jul 13, 2021

Hi, I have installed mercurius 8.0.0 and when I try to make validatioRule options working, I no other choice to set cache to false. Doing this, server starts but for any request I am passing to the gateway , I get this king of error

{
  "data": {
    "accounts": null
  },
  "errors": [
    {
      "message": "Cannot read property 'get' of null",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "accounts"
      ]
    }
  ]
}

here is my configuration on the 2 apollo server services

gateway.register(mercurius, {
    graphiql: false,
    ide: false,
    path: '/graphql',
    jit: 1,
    gateway: {
      services: [{
        name: 'accounts',
        url: 'http://localhost:4002/graphql',
        rewriteHeaders: (headers, context) => {
          return { 'Authorization': headers.authorization }
        }
      }, {
        name: 'user',
        url: 'http://localhost:4003/graphql',
        rewriteHeaders: (headers, context) => {
          return { 'Authorization': headers.authorization }
        }
      }]
    },

   validationRules:() => []  
   
  ,cache: false
 
})

just removing the validationRules option , and setting back to cache:true makes the call successful

@benjaminIDruide
Copy link
Author

did another test right now, just setting cache to false induce this error

@mcollina
Copy link
Collaborator

Could you add a script to fully reproduce the problem? Or at least enable the logs of fastify and include the full stacktrace?

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

2 participants