Understood, is there any example of how to do it with Next Server Routes?
Understood, is there any example of how to do it with Next Server Routes?
/hello ... but it's not.core:user:worker: Uncaught ReferenceError: process is not defined context.env.VARawait points (no IO) inside initFromEnv then you should be good.await'ing inside the initFromEnv then there's concurrency issues because Workers may switch the request they're serving on await points.{"env":"prod"} , there's no sub-fetch or database queries going on. The endpoint sets cache-control: private. On my BetterStack graph, I'm seeing lots of requests which take ~1 second and even a handful which take ~2 seconds. I switched to paid workers, but don't see any difference in the graph. So a couple questions:
Response.json()Workers with a D1 binding will always be placed in a data center near the location of the D1 database they are bound to => I do have a D1 binding.pnpx wrangler dev functions it keeps saying pnpx wrangler dev functions/get_info/index.js my script works perfectly. 
context.request object is completely empty?context.request.url to at least exist?JSON.stringify(context) look like:http://localhost:8788/api/auth-callback?token=aaabbbJSON.stringify (and sometimes console.log) - it doesn't handle properties on most objects.context.request.url directly

wrangler pages functions build ... then run the compiled file via plain wrangler dev in local and remote mode and wrangler deploy All worked fine. Also the compiled script was 700kb minified gzipped.build.minify in my vite config and it deployed. I guess I am closer to the 1mb limit than I thought.wrangler pages deploy minify by default?wrangler pages deploy show the uploaded size of the worker bundle? (Right now it just shows Uploading Functions bundle) (Edit I found an existing feature request)$ find _site
_site
_site/index.html
_site/functions
_site/functions/hello.js/hellocore:user:worker: Uncaught ReferenceError: process is not definedcontext.env.VARconst db = initFromEnv(env)
export async function onRequestGet(context) {
// use db
}initFromEnv{"env":"prod"}cache-control: privateResponse.json()Workers with a D1 binding will always be placed in a data center near the location of the D1 database they are bound to├─ functions
│ └─ get_info
│ └─ index.jspnpx wrangler dev functions [ERROR] The entry-point file at "functions" was not found.
The provided entry-point path, "functions", points to a directory, rather than a file.pnpx wrangler dev functions/get_info/index.jscontext.requestcontext.request.urlcontext.request.urlJSON.stringify(context)http://localhost:8788/api/auth-callback?token=aaabbbwrangler pages functions build ...build.minifyUploading Functions bundlelet variable;
export async function onRequestGet(context) {
if (variable == null) {
variable = initFromEnv(env);
}
// ...use variable
}{
"request": {},
"functionPath": "/api/auth-callback",
"params": {},
"data": {},
"env": {
"ASSETS": {}
}
}