framework icon indicating copy to clipboard operation
framework copied to clipboard

Missing default export in server bundle when trying to deploy to netlify edge functions

Open YannicEl opened this issue 2 years ago • 2 comments

Environment


  • Operating System: Windows_NT
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.4
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: nitro
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/YannicEl/nitro-netlify-edge-deploy-error

  1. clone the repo
  2. npm i
  3. npm run dev:netlify

This will run the edge function locally with the netlify cli

Describe the bug

When trying to deploy a default nuxt3-rc4 project to netlify edge functions I get following error: Uncaught SyntaxError: The requested module 'file:///root/server.js' does not provide an export named 'default' at netlify:bootstrap-stage2:1:8

Running the edge function locally with the netlfiy cli produces a similar error.

I am not sure if I misconfigured something or if the nitro preset „netlify-edge“ doesn’t work as intended.

Additional context

No response

Logs

Netlify dashboard:
Uncaught SyntaxError: The requested module 'file:///root/server.js' does not provide an export named 'default' at netlify:bootstrap-stage2:1:8

Netlify CLI local emulator:
◈ Failed to load Edge Function server. The file does not seem to have a function as the default export.
TypeError: func.function is not a function
    at FunctionChain.runFunction (https://628282fb528ce20008ed7664--edge-bootstrap.netlify.app/bootstrap/function_chain.ts:152:43)
    at FunctionChain.run (https://628282fb528ce20008ed7664--edge-bootstrap.netlify.app/bootstrap/function_chain.ts:131:33)
    at handleRequest (https://628282fb528ce20008ed7664--edge-bootstrap.netlify.app/bootstrap/handler.ts:34:34)
    at Server.<anonymous> (https://628282fb528ce20008ed7664--edge-bootstrap.netlify.app/bootstrap/server.ts:19:23)
    at Server.#respond (https://deno.land/[email protected]/http/server.ts:298:37)
    at Server.#serveHttp (https://deno.land/[email protected]/http/server.ts:340:20)

YannicEl avatar Jun 17 '22 20:06 YannicEl

I'm facing the same issue. @YannicEl, did you find a workaround already? @danielroe, do you have any hints on how to solve this one?

ilyasmez avatar Jun 23 '22 08:06 ilyasmez

@ilyasmez no i have not found a workaround

YannicEl avatar Jun 23 '22 09:06 YannicEl