-
Notifications
You must be signed in to change notification settings - Fork 147
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
Authentication with Netlify Deploy Returns error:Forbidden #245
Comments
Thanks for opening this issue @jaedag. |
We could also do with some debug output here - could you set the environment variable |
Currently I'm using GraphiQL to test the netlify function. I'm setting the jwt my self. And like I mentioned earlier it all works locally on my machine, but not when I deploy through |
Trying this now |
@darrellwarde This is what I'm getting. But I'm not sure why. Can you please help? Here is my server constructor
I understand that apollo-server-lambda returns an event object instead of a req. So I tried reassigning but looks like it didn't work? |
And to ask a stupid question as I'm sure you are, but you're definitely passing the |
Hi. Are you sure |
I feel as though it should be this: const server = new ApolloServer({
schema: neoSchema.schema,
context: ({ req }) => {
return { req } ;
},
}); |
Yeah @danstarns. The event object is there. I'm trying your code now though |
PR #246 that makes the debug output a little nicer for situations like this. |
This is what eventually worked for me. In case anyone else should need it. Apparently lambda functions pass an |
Of course, should have spotted that: const server = new ApolloServer({
schema: neoSchema.schema,
context: ({ event }) => {
const req = event
return req
},
introspection: true,
playground: false,
}) Should have been: const server = new ApolloServer({
schema: neoSchema.schema,
context: ({ event }) => {
const req = event
return { req }
},
introspection: true,
playground: false,
}) I agree, this should be in the docs. I think for a better developer experience, we could look for headers in the appropriate places for all of the compatible middlewares for Apollo: https://www.apollographql.com/docs/apollo-server/api/apollo-server/#middleware-specific-context-fields |
Closing this particular issue as now resolved, both points regarding docs and extracting from different places have now been raised in Trello. 🙂 |
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"] }])
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
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!
System:
The text was updated successfully, but these errors were encountered: