grand-stack / grand-stack-starter

Simple starter project for GRANDstack full stack apps

Home Page:https://grandstack.io/docs/getting-started-grand-stack-starter.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authentication with Grandstack starter not working with netlify deploy @neo4j/graphql

jaedag opened this issue · comments

Hi Everyone,

I'm trying to deploy my first app using GRANDstack with netlify.
I'm having some issues implementing authentication.

I've created an @auth directive

extend type Member @auth(rules: [{ roles: ["federalAdmin"] }])

{
  members {
    id
  }
}

I don't know what it is, but the same queries that I run on my local machine work perfectly but when I run them against my function in the cloud, I get the response

{
  "errors": [
    {
      "message": "Forbidden",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "maritalStatuses"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Neo4jGraphQLForbiddenError: Forbidden",
            "    at Object.<anonymous> (/Users/jd/Documents/dev/fl-admin-portal/api/node_modules/@neo4j/graphql/src/utils/execute.ts:95:19)",
            "    at Generator.throw (<anonymous>)",
            "    at rejected (/Users/jd/Documents/dev/fl-admin-portal/api/node_modules/@neo4j/graphql/dist/utils/execute.js:24:65)",
            "    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
          ]
        }
      }
    }
  ],
  "data": null
}

I would like to know if there is something I am doing wrong or if this is a bug in netlify or in GRANDstack. Any help?

Has anyone been able to implement authentication with a netlify function so far?

My code can be found here https://github.com/jaedag/fl-admin-portal.

Thanks in advance!

This was solved here