The build successfully finishes, but when I try to open the link I’m getting a HTTP 502 error. Someone in the Shopify Discord suggested that it might have to do with the wrong AWS Lambda Node runtime of Netlify Functions, which I tried to solve via environment variables in the UI (like desribed here: AWS_LAMBDA_JS_RUNTIME - nodejs14.x - #2 by lambrospetrou) but this also didn’t help.
I meant, you could try using Hydrogen without using Edge Functions to see if the issue is solved - at least till we’re able to take a deeper dive in the Edge Function situation.
FYI, our team has found the root cause of this problem. Your edge function must begin returning at least HTTP response headers (it can wait somewhat longer to return more data, such as the body) within 40 seconds, or we will stop executing. Your edge functions do not seem to do so, and thus they are killed off at 40 seconds by us as we assume they are not going to work and will not keep the idle connection open for longer.
Thanks for getting back and please excuse my delay in response. Since I’m completely new to Edge Functions: Do I add a second Edge function to my hydrogen environment that returns custom headers (besides the handler/index.js)? Or does my handler/index.js need to return the headers?
We’re experiencing the same problem. We don’t have an explicate edge function directory but I believe that Hydrogen automatically deploys server code to Edge Functions.
I suppose it’s possible that this code is exceeding the 40s timeout.
To help with debugging:
Is there a way to view the edge function logs to find which part of our code is hanging?
Is there a way for us to stop Hydrogen from deploying to Edge Functions as a test?
Unfortunately the logs are perpetually hanging. Furthermore the console has a few CORS errors. Is this something you’ve come across before?
It’s making it pretty difficult to debug.