Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netlify Edge functions context is not available locally #4908

Closed
brittneypostma opened this issue May 13, 2022 · 1 comment
Closed

Netlify Edge functions context is not available locally #4908

brittneypostma opened this issue May 13, 2022 · 1 comment

Comments

@brittneypostma
Copy link
Contributor

Describe the bug

When edge: true is set in the svelte.config.js file, the event.platform.context can only be seen on a deployed site. On sveltekit's port it is underfined and running ntl dev gets an empty object which does mean that it exists, however it is not a great dev experience for testing and creating edge functions. I would like to see the same thing locally as the deployed application shows. I'm unsure if this problem lies in the adapter or in ntl dev but figured I would start here.

Reproduction

Repo: https://github.com/brittneypostma/sveltekit-on-the-edge

  • Run pnpm run dev at localhost:3000, undefined is shown on the / route. No errors in console, but warning about expected prop ctx not being present.
  • Run ntl dev at localhost:8888, {} is shown on the / route. There are 4 errors in the console, all 404s about resources not being found. I posted these in the logs below.
  • Deploy site to Netlify and full ctx object is present on the / route. No errors in console.

Logs

Failed to load resource: the server responded with a status of 404 (Not Found)

start-b2afe8b6.js:1 
index-dd64db13.js:1 
__layout.svelte-0d57de41.js:1 
index.svelte-9a34a6ed.js:1

System Info

System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 689.52 MB / 16.00 GB
    Shell: 5.8 - /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: 101.0.4951.64
    Firefox Developer Edition: 101.0
    Safari: 15.4
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.40 
    @sveltejs/adapter-netlify: 1.0.0-next.56 => 1.0.0-next.56 
    @sveltejs/kit: next => 1.0.0-next.326 
    svelte: ^3.44.0 => 3.48.0

Severity

annoyance

Additional Information

No response

@Rich-Harris
Copy link
Member

Yeah, this is a special case of #3535 and #4292. I'm going to close this issue as it's basically covered by those. It's high priority though I haven't quite wrapped my head round how it'll work, since ntl dev and vc dev and wrangler etc don't provide obvious ways to hook into Vite's server (or vice versa)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants