I try to implement chaining pattern when one function is calling another, and that another one in this way
await fetch(req.url.replace('day', 'week'))
https://ME.netlify.app/getday?day=2022-07-10 to https://ME.netlify.app/getweek?day=2022-07-10
it works fine on local “netlify dev” but after deploy its generate 502 error:
Response {
body: ReadableStream { locked: true },
bodyUsed: true,
headers: Headers {
"content-length": "62",
"content-type": "text/plain; charset=utf-8",
date: "Wed, 13 Jul 2022 20:36:32 GMT",
server: "Netlify",
"strict-transport-security": "max-age=31536000; includeSubDomains; preload",
"x-nf-request-id": "01G7WME3PH1VXFKZEPFHGR6QXB"
},
ok: false,
redirected: false,
status: 502,
statusText: "Bad Gateway",
url: "https://ME.netlify.app/getweek?day=2022-07-10"
}
how to fix this?