Tielem
04/29/2023, 6:27 PMservices = [
{ binding = "GATEWAY", service = "gateway-main" }
]
When I locally start the remix project, I see the following output in console
▲ [WARNING] This worker is bound to live services: GATEWAY (gateway-main)
Your worker has access to the following bindings:
- Services:
- GATEWAY: gateway-main
▲ [WARNING] ⎔ Support for service bindings in local mode is experimental and may change.
But I have no idea how to access the binding. The docs make it seem like I can do context.env.GATEWAY or context.GATEWAY in my loader functions - I can't.
I also tried looking at the context parameter on server.ts
export const onRequest = createPagesFunctionHandler({
build,
getLoadContext: (context) => {
console.log(context);
return context.env;
},
mode: process.env.NODE_ENV,
});
But the context object only has an ASSETS Fetcher on its env parameter.
{
...
functionPath: '/',
next: [AsyncFunction: next],
params: [Object: null prototype] {},
data: {},
env: { ASSETS: Fetcher {} },
waitUntil: [Function: bound waitUntil],
passThroughOnException: [Function: passThroughOnException]
}
I'm a bit very stuck with this and would like advice. Thank you!Tielem
04/30/2023, 1:22 PMnode ➜ /workspaces/monorepo/apps/web-pages (main) $ pnpm exec wrangler pages dev --help
wrangler pages dev [directory] [-- command..]
🧑💻 Develop your full-stack Pages application locally
Positionals:
directory The directory of static assets to serve [string]
command The proxy command to run [string]
Flags:
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Options:
--local Run on my machine [boolean] [default: true]
...
--log-level Specify logging level [choices: "debug", "info", "log", "warn", "error", "none"]
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose