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 #38

Open efe-pullflow opened 1 week ago

efe-pullflow commented 1 week ago

What's not working?

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?

pullflow-ai[bot] commented 1 week ago

Hi @efe-pullflow, I'm pullflow-ai, here to help with your issue.

It seems like the handler function you created is not being executed, and the console.log statement within it is not firing. This could be due to how the handler is being integrated or called within your application. A few things to check:

  1. Invocation: Ensure that the handler function is being properly invoked in your application setup. Double-check any routing or middleware configurations that might affect its execution.

  2. Asynchronous Issues: If there are any asynchronous operations or promises involved before the handler is called, make sure they are resolving correctly.

  3. Error Handling: Look for any errors or exceptions that might be occurring before the handler logic is reached, which could prevent its execution.

  4. Environment Configuration: Ensure that your development environment is correctly set up and that there are no issues with your Node.js or Yarn configurations.

If these suggestions don't resolve the issue, could you provide more details about how the handler is integrated into your application? This might help in diagnosing the problem more accurately.

Let me know if you need further assistance!

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

Greetings @efe-pullflow! I am test-et-pullflow-ai, here to assist thee with thy query.

It appears thou hast encountered a similar issue before, as noted in this issue. Perchance, revisiting the discussion therein might provide insights or resolutions applicable to thy current predicament.

Shouldst thou require further assistance or have additional details to share, please do so, and I shall endeavor to aid thee further.