Hello RW community,
I am trying to upgrade my rewood environment from 3.x to 4.0. The upgrade went smooth without any issue. However, when I run yarn rw dev
, I see errors on the server side as below
api | 🚨 TypeError Info
api |
api | {}
api |
api | 🥞 Error Stack
api |
api | TypeError: Cannot read properties of undefined (reading 'toUpperCase')
api | at onRequest (/Home/project_sample/node_modules/graphql-yoga/cjs/plugins/useCORS.js:111:32)
api | at YogaServer.getResponse (/Home/project_sample/node_modules/graphql-yoga/cjs/server.js:289:23)
api | at processTicksAndRejections (node:internal/process/task_queues:96:5)
api | at async YogaServer.handle (/Home/project_sample/node_modules/graphql-yoga/cjs/server.js:41:34)
api | at async handlerFn (/Home/project_sample/node_modules/@redwoodjs/graphql-server/dist/functions/graphql.js:178:24)
api | at async execFn (/Home/project_sample/node_modules/@redwoodjs/graphql-server/dist/functions/graphql.js:233:16)
api | at async requestHandler (/Home/project_sample/node_modules/@redwoodjs/api-server/dist/requestHandlers/awsLambdaFastify.js:72:30)
api |
api | 22:07:28 🚨 Cannot read properties of undefined (reading 'get')
api |
api | 🚨 TypeError Info
api |
api | {}
api |
api | 🥞 Error Stack
api |
api | TypeError: Cannot read properties of undefined (reading 'get')
api | at getMediaTypesForRequestInOrder (/Home/project_sample/node_modules/graphql-yoga/cjs/plugins/resultProcessor/accept.js:5:38)
api | at onResultProcess (/Home/project_sample/node_modules/graphql-yoga/cjs/plugins/useResultProcessor.js:39:86)
api | at processResult (/Home/project_sample/node_modules/graphql-yoga/cjs/process-request.js:10:15)
api | at YogaServer.getResponse (/Home/project_sample/node_modules/graphql-yoga/cjs/server.js:349:71)
api | at processTicksAndRejections (node:internal/process/task_queues:96:5)
api | at async YogaServer.handle (/Home/project_sample/node_modules/graphql-yoga/cjs/server.js:41:34)
api | at async handlerFn (/Home/project_sample/node_modules/@redwoodjs/graphql-server/dist/functions/graphql.js:178:24)
api | at async execFn (/Home/project_sample/node_modules/@redwoodjs/graphql-server/dist/functions/graphql.js:233:16)
api | at async requestHandler (/Home/project_sample/node_modules/@redwoodjs/api-server/dist/requestHandlers/awsLambdaFastify.js:72:30)
It seems to me api/src/functions/graphql.js
is not working properly. It looks like below
import { authDecoder } from '@redwoodjs/auth-dbauth-api'
import { createGraphQLHandler } from '@redwoodjs/graphql-server'
import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{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({
authDecoder,
getCurrentUser,
// cors: {
// origin: '*',
// credentials: true,
// },
loggerConfig: { logger, options: { requestId: true } },
directives,
sdls,
services,
armorConfig: { maxDepth: { n: 6 } },
onException: () => {
// Disconnect from your database with an unhandled exception.
db.$disconnect()
},
})
The frontend loads without issue but I am struggling getting the backend running.