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 adapter build failure with Edge enabled #4692

Closed
coldino opened this issue Apr 22, 2022 · 5 comments · Fixed by #4702
Closed

Netlify adapter build failure with Edge enabled #4692

coldino opened this issue Apr 22, 2022 · 5 comments · Fixed by #4702

Comments

@coldino
Copy link

coldino commented Apr 22, 2022

Describe the bug

Tried to use the new Netlify Edge option in an existing project and it resulted in a no such file or directory error about .svelte-kit/netlify-tmp/manifest.js.

Confirmed it also happens on a freshly created skeleton app, with the only change being to switch to the Netlify adapter and setting edge: true.

Reproduction

$ npm init svelte test-netlify-edge  # skeleton, nothing else enabled
$ cd test-netlify-edge
$ npm i -D @sveltejs/adapter-netlify@1.0.0-next.53
$ npm uninstall @sveltejs/adapter-auto
$ code .  # to edit svelte.config.js, switching to adapter-netlify and setting edge: true
$ npm run build
...
ENOENT: no such file or directory, open 'D:\Work\tmp\test-netlify-edge\.svelte-kit/netlify-tmp/manifest.js'
...

Logs

/d/Work/tmp
$ npm init svelte test-netlify-edge

create-svelte version 2.0.0-next.131

Welcome to SvelteKit!

This is beta software; expect bugs and missing features.

Problems? Open an issue on https://github.com/sveltejs/kit/issues if none exists already.

√ Which Svelte app template? » Skeleton project
√ Add type checking? » None
√ Add ESLint for code linting? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes
√ Add Playwright for browser testing? ... No / Yes

Your project is ready!

Install community-maintained integrations:
  https://github.com/svelte-add/svelte-adders

Next steps:
  1: cd test-netlify-edge
  2: npm install (or pnpm install, etc)
  3: git init && git add -A && git commit -m "Initial commit" (optional)
  4: npm run dev -- --open

To close the dev server, hit Ctrl-C

Stuck? Visit us at https://svelte.dev/chat


/d/Work/tmp
$ cd test-netlify-edge/

/d/Work/tmp/test-netlify-edge
$ npm i -D @sveltejs/adapter-netlify@1.0.0-next.53

added 39 packages, and audited 40 packages in 9s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

/d/Work/tmp/test-netlify-edge
$ npm uninstall @sveltejs/adapter-auto

removed 6 packages, and audited 34 packages in 808ms

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

/d/Work/tmp/test-netlify-edge
$ code .  

/d/Work/tmp/test-netlify-edge
$ npm run build

> test-netlify-edge@0.0.1 build
> svelte-kit build

vite v2.9.5 building for production...
✓ 13 modules transformed.
.svelte-kit/output/client/_app/manifest.json                    1.14 KiB
.svelte-kit/output/client/_app/layout.svelte-935bdc13.js        0.53 KiB / gzip: 0.35 KiB
.svelte-kit/output/client/_app/error.svelte-73783925.js         1.56 KiB / gzip: 0.74 KiB
.svelte-kit/output/client/_app/pages/index.svelte-2cee61c3.js   0.80 KiB / gzip: 0.47 KiB
.svelte-kit/output/client/_app/chunks/index-dd45c2ae.js         6.83 KiB / gzip: 2.79 KiB
.svelte-kit/output/client/_app/start-c262f413.js                22.99 KiB / gzip: 8.63 KiB
vite v2.9.5 building SSR bundle for production...
✓ 11 modules transformed.
Generated an empty chunk: "hooks"
.svelte-kit/output/server/manifest.json                        1.09 KiB
.svelte-kit/output/server/index.js                             75.34 KiB
.svelte-kit/output/server/entries/fallbacks/layout.svelte.js   0.24 KiB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js    0.72 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js        0.32 KiB
.svelte-kit/output/server/chunks/index-2dc61825.js             2.29 KiB
.svelte-kit/output/server/chunks/hooks-1c45ba0b.js             0.00 KiB

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-netlify
  No netlify.toml found. Using default publish directory. Consult https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify#configuration for more details
> ENOENT: no such file or directory, open 'D:\Work\tmp\test-netlify-edge\.svelte-kit/netlify-tmp/manifest.js'
    at Object.openSync (node:fs:585:3)
    at writeFileSync (node:fs:2157:35)
    at generate_edge_functions (file:///D:/Work/tmp/test-netlify-edge/node_modules/@sveltejs/adapter-netlify/index.js:127:2)
    at adapt (file:///D:/Work/tmp/test-netlify-edge/node_modules/@sveltejs/adapter-netlify/index.js:66:11)
    at adapt (file:///D:/Work/tmp/test-netlify-edge/node_modules/@sveltejs/kit/dist/chunks/index4.js:181:8)
    at file:///D:/Work/tmp/test-netlify-edge/node_modules/@sveltejs/kit/dist/cli.js:937:11

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 19.53 GB / 31.55 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.44)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-netlify: ^1.0.0-next.53 => 1.0.0-next.53
    @sveltejs/kit: next => 1.0.0-next.318
    svelte: ^3.44.0 => 3.47.0

Severity

blocking an upgrade

Additional Information

No response

@Rich-Harris
Copy link
Member

I've released a new version of adapter-netlify — can you see if it fixes this issue? thanks

@coldino
Copy link
Author

coldino commented Apr 22, 2022

Thanks for the quick response.

At least it moves on to another error!

X [ERROR] Could not resolve "D:\\Work\\tmp\\test-netlify-edge\\.svelte-kit/netlify-tmp/entry.js"

> Build failed with 1 error:
error: Could not resolve "D:\\Work\\tmp\\test-netlify-edge\\.svelte-kit/netlify-tmp/entry.js"
error: Could not resolve "D:\\Work\\tmp\\test-netlify-edge\\.svelte-kit/netlify-tmp/entry.js"
    at failureErrorWithLog (D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:1603:15)
    at D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:1249:28
    at runOnEndCallbacks (D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:1162:65)
    at buildResponseToResult (D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:1247:7)
    at D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:1356:14
    at D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:666:9
    at handleIncomingPacket (D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:763:9)
    at Socket.readFromStdout (D:\Work\tmp\test-netlify-edge\node_modules\esbuild\lib\main.js:632:7)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)

@PeterW570
Copy link

I'm also getting the same error as the previous comment: Could not resolve "/Users/[...]/.svelte-kit/netlify-tmp/entry.js"

I see that this line is trying to copy src/edge_function.js into netlify-tmp/entry.js, but I see no src directory in my node_modules/@sveltejs/adapter-netlify

/Users/[...]/node_modules/@sveltejs/adapter-netlify
├── LICENSE
├── README.md
├── files
│   ├── cjs
│   │   ├── handler.js
│   │   ├── multipart-parser-431aff0b.js
│   │   └── shims.js
│   └── esm
│       ├── handler.js
│       ├── multipart-parser-5faf185a.js
│       └── shims.js
├── index.d.ts
├── index.js
└── package.json

Hope that info helps!

@Rich-Harris Rich-Harris mentioned this issue Apr 22, 2022
5 tasks
@Rich-Harris
Copy link
Member

Ah yep, that makes sense, thanks — src isn't included in the package. Opened #4702

@coldino
Copy link
Author

coldino commented Apr 23, 2022

This one works - thanks!

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

Successfully merging a pull request may close this issue.

3 participants