This is my graphql.ts
that I use in an app that uses Netlify Identity to authenticate:
import {
createGraphQLHandler,
makeMergedSchema,
makeServices,
} from '@redwoodjs/graphql-server'
import schemas from 'src/graphql/**/*.{js,ts}'
import services from 'src/services/**/*.{js,ts}'
import { getCurrentUser } from 'src/lib/auth'
import { db } from 'src/lib/db'
import { logger } from 'src/lib/logger'
export const handler = createGraphQLHandler({
loggerConfig: {
logger,
options: { tracing: true, operationName: true },
},
getCurrentUser,
schema: makeMergedSchema({
schemas,
services: makeServices({ services }),
}),
db,
})
That’s all I need.
If you need the Sentry plugin, then I suggest using useSentry – GraphQL Envelop and then setting that in the extraPlugins: [useSentry({...yourOptions}]
attribute.
Not sure why you’d need to have
context: async ({ event, context }) => {
const authContext = await getAuthenticationContext({ event, context })
return authContext
},
as that is done here:
Question:
- What/who’s your auth provider type?
- You are running on Render?
- You are running via api serve? Ie, not serverless?
- What is in
requireAuth()
that is checking and saying Forbidden? Is current user present? - If you log while in
getCurrentUser()
do you see the user info? - Do you see same behavior locally running via
yarn rw serve
?