you can put that in your `wrangler.toml` file or `.dev.vars` file
you can put that in your
wrangler.toml file or .dev.vars filec.get('sentry') -- that returns emptyheaders.set('Accept', 'application/json'); ,it will throw errorsnodejs_compatcompatibility_flags = ["nodejs_compat"] and node_compat = true not having the same compatabilitynode_compat polyfill system, which isn't supported on Functions.wranglersamlify and it is importing some exports from node-forge but those are undefined. I get TypeError: Cannot read properties of undefined (reading 'decode64') at .... It works fine locally but I'm not sure how to debug what is going on when it's deployed to CloudFlare. Does anyone have any ideas? "stack": " at run7 (functionsWorker-0.9172056921113851.js:425:19)
at async onRequest8 (functionsWorker-0.9172056921113851.js:374:12)
at async next (functionsWorker-0.9172056921113851.js:915:26)
at async Object.fetch (functionsWorker-0.9172056921113851.js:929:14)",export default {
async fetch(request, env) {
const url = new URL(request.url);
if (url.pathname.startsWith('/api/')) {
const apiRequest = new Request(
`https://your-worker-url.com${url.pathname}`,
request
);
return env.MY_WORKER_SERVICE.fetch(apiRequest);
}
return env.ASSETS.fetch(request);
},
};
});// functions/api/[[route]].ts
export const onRequest: PagesFunction = ({ request }) => {
const url = new URL(request.url);
url.host = "your-worker-url.com";
return fetch(url.toString(), request);
};