question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Edge adapter-netlify not providing platform or context object

See original GitHub issue

Describe 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. image

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:closed
  • Created a year ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
brittneypostmacommented, Oct 20, 2022

Thank you for the explanations and looking into this for me!

1reaction
dummdidummcommented, Oct 20, 2022

Yeah, edge is false by default and adapter-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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[fix] more informative serialization error messages #7303
Ideally, include a test that fails without this PR but passes with ... Edge adapter-netlify not providing platform or context object #7297.
Read more >
Microsoft Edge Browser Policy Documentation
Windows and Mac documentation for all policies supported by the Microsoft Edge Browser.
Read more >
Context in Edge Extension Modules - Experience League
Learn about the context object and the role it plays in interacting with library modules in tag extensions of edge properties.
Read more >
Starting with Svelte - CFE.dev
Svelte by itself is a component framework that allows you to break up your application into reusable chunks, built in animations and transitions...
Read more >
sveltekit require is not defined - You.com | The AI Search ...
Svelte giving me 'Uncaught ReferenceError: require is not defined' ... <script context='module'> // Fetch in load for client side usage export const load ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found