-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: Calling serverless function does not work when server started with yarn rw serve
#9355
Comments
Thanks for reporting and including a reproduction @standuprey! Funny I brought up edge cases like this just earlier this week. There's some differences between dev and serve:
I was going to make serve act the same as dev—just start two processes. But stepping back a bit, it looks like you want to call one of your api functions (here "myfunc") from graphql right? Or was there more to it than that? |
yes, that’s it basically, calling a function from another function. i had try to make |
Hey @standuprey - I recently had to deal with a similar problem on ssr-streaming. I haven't reviewed your usecase though, so no thoughts on why you are trying to hit a function endpoint. When you run on
I hope this is helpful, and not actually making things worse 🤣, that's what I currently have in the experimental ssr setup! |
I still don't 100% understand why a function is called by the a graphql service resolver. If the feature needs to be shared, the logic can be put in something shared like a lib. The graphql resolver/service is async, so, I can't see which the async part need to be a function. Is it that you want to "execute and forget" meaning trigger the async part but return right away? If so, I think the new defer directive in realtime is what you may want. See: #9235 and https://the-guild.dev/graphql/yoga-server/v4/features/defer-stream#using-defer If these needs to be deployed on serverless like Vercel or Netlify, let me know -- I think defer should be possible. |
Hey @standuprey! Just in triage mode at the moment - there's a few suggestions on this thread that are worth trying! For now I'll close it the issue, but if you feel like you need more of a solution from the framework side feel free to comment and re-open. |
What's not working?
I have a serverless function called from graphql to do some async work.
This works fine when the server is started with yarn rw dev or in production.
But when I start the server with yarn rw serve I get connect
ECONNREFUSED ::1:8911
How do we reproduce the bug?
Here is a repo to reproduce the bug:
GitHub
If you start this with
yarn rw dev
there is a button on the homepage that works, but it doesn’t work if you start the app withrw build && rw serve
Ticket created from this discussion: https://community.redwoodjs.com/t/error-calling-a-function-from-graphql-when-started-with-rw-serve/5476
What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: