pullflow-ai / sample-redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
0 stars 0 forks source link

[Bug?]: Graphql handler is not executed if it's a wrapper #46

Open efe-pullflow opened 1 month ago

efe-pullflow commented 1 month ago

What's not working?

When creating a wrapper called handler around createGraphQLHandler function it never get executed.

Example graphql.ts

const graphqlHandler = createGraphQLHandler({ loggerConfig: { logger, options: {} }, directives, sdls, services, onException: () => { // Disconnect from your database with an unhandled exception. db.$disconnect() }, })

export async function handler(event, context) { // this never gets fired console.log(in handler wrapper)

const requestIdHeader = 'x-request-id' const requestId = event.headers[requestIdHeader] const store: Store = new Map([['requestId', requestId]]) const response = await executionContext.run(store, () => { return graphqlHandler(event, context) }) return { ...response, headers: { ...(response.headers ?? {}), [requestIdHeader]: requestId }, } } When you run this app, the console.log(in handler wrapper) never gets fired.

How do we reproduce the bug? clone https://github.com/jan-stehlik/rw-graphql-issue/tree/main yarn install yarn rw dev open http://localhost:8910/ and have a look at server logs - console.log(in handler wrapper) doesn't get triggered What's your environment? (If it applies) Redwood 8.0.0 Node 20.16 Yarn 4.4 Are you interested in working on this? I'm interested in working on this

How do we reproduce the bug? No response

What's your environment? (If it applies) No response

Are you interested in working on this? I'm interested in working on this

How do we reproduce the bug?

No response

What's your environment? (If it applies)

No response

Are you interested in working on this?

test-et-pullflow-ai[bot] commented 1 month ago

Hi @efe-pullflow, I'm test-et-pullflow-ai, here to help with your issue. It seems like the handler function isn't being executed as expected when wrapping the createGraphQLHandler. Could you please confirm if there are any errors or warnings in the server logs that might provide additional clues? Additionally, it might be helpful to check if the createGraphQLHandler function is being called correctly within the wrapper. If possible, try logging inside the handler to ensure it's being reached. Let me know if there's any more information you can provide to help diagnose the problem!

I've found some similar issues that might help you, please take a look at them here: https://github.com/pullflow-ai/sample-redwood/issues/40