Edge adapter-netlify not providing platform or context object
See original GitHub issueDescribe the bug
Digging into the code for adapter-netlify
, it looks like platform and context should be provided on the event from the load function.
There is no such object on the event in my edge functions log and the client console.
Originally I had adapter-auto
installed and that was causing functions to run in regular the serverless setting and not on the edge network also. I explicitly installed adapter-netlify
and was able to get it at least running on the edge, but still no platform or context object. I’ve been looking at it all day and can’t see what’s wrong.
Reproduction
Repo: https://github.com/brittneypostma/demo-sveltekit-edge/blob/main/src/routes/edge/%2Bpage.ts Endpoint: https://demo-sveltekit-edge.netlify.app/edge
Logs
6:04:10 PM: {
url: URL {
href: "https://demo-sveltekit-edge.netlify.app/edge",
origin: "https://demo-sveltekit-edge.netlify.app",
protocol: "https:",
username: "",
password: "",
host: "demo-sveltekit-edge.netlify.app",
hostname: "demo-sveltekit-edge.netlify.app",
port: "",
pathname: "/edge",
hash: "",
search: ""
},
params: {},
data: null,
routeId: "edge",
fetch: [AsyncFunction: fetch],
setHeaders: [Function: setHeaders],
depends: [Function: depends],
parent: [AsyncFunction: parent]
}
6:04:10 PM: [render] undefined
6:04:10 PM: [render] undefined
6:09:44 PM: {
url: URL {
href: "https://demo-sveltekit-edge.netlify.app/edge",
origin: "https://demo-sveltekit-edge.netlify.app",
protocol: "https:",
username: "",
password: "",
host: "demo-sveltekit-edge.netlify.app",
hostname: "demo-sveltekit-edge.netlify.app",
port: "",
pathname: "/edge",
hash: "",
search: ""
},
params: {},
data: null,
routeId: "edge",
fetch: [AsyncFunction: fetch],
setHeaders: [Function: setHeaders],
depends: [Function: depends],
parent: [AsyncFunction: parent]
}
6:09:44 PM: [render] undefined
6:09:44 PM: [render] undefined
System Info
System:
OS: macOS 12.6
CPU: (10) arm64 Apple M1 Pro
Memory: 80.50 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
Browsers:
Chrome: 106.0.5249.119
Firefox Developer Edition: 103.0
Safari: 16.0
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.83
@sveltejs/adapter-netlify: ^1.0.0-next.81 => 1.0.0-next.81
@sveltejs/kit: next => 1.0.0-next.516
svelte: ^3.46.0 => 3.52.0
vite: ^3.1.0 => 3.1.8
Severity
blocking all usage of SvelteKit
Additional Information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:16 (16 by maintainers)
Thank you for the explanations and looking into this for me!
Yeah,
edge
isfalse
by default andadapter-auto
doesn’t accept any configuration, it’s more of a “I want to get up and running as quickly as possible without worrying about any environment config and adapter stuff”-entry solution. The moment you know where you deploy to and want to configure that, you need to switch to the specific adapter.