-
I'm trying to deploy a Yoga Graphql to Vercel using Next Js.
This is my import { createYoga } from 'graphql-yoga'
import { useGraphQLMiddleware } from '@envelop/graphql-middleware'
import type { NextApiRequest, NextApiResponse } from 'next'
//...More imports here, concerning auth and other stuff.
//...imported middlwares
export const config = {
api: {
// Disable body parsing (required for file uploads)
bodyParser: false,
},
}
export default createYoga<{
req: NextApiRequest
res: NextApiResponse
}>({
graphqlEndpoint: '/api/graphql',
context: async ({request}) => {
const token = request?.headers?.get('Authorization')?.slice(7)
return {
jwt: token,
}
},
schema: neoSchema.getSchema(),
plugins: [
useGraphQLMiddleware([middlewares])
],
}) I know that this has something about calling a Hook outside a React function, but bear with me here, I really don't know how to solve this "Yoga and Next js" wise. Any help would be much appreciated. Thank you and best regards. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @inc16sec, You can disable this React-specific rule eslint rule via the following comment at the beginning of the file. /* eslint-disable react-hooks/rules-of-hooks */ You can learn more about disabling eslint rules at https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-rules |
Beta Was this translation helpful? Give feedback.
Hey @inc16sec,
You can disable this React-specific rule eslint rule via the following comment at the beginning of the file.
/* eslint-disable react-hooks/rules-of-hooks */
You can learn more about disabling eslint rules at https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-rules