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.

Demo app cannot be built with the static adapter since the introduction of shadow endpoints (error 500 /todos)

See original GitHub issue

Describe the bug

PR3679 has broken the demo application build process for static adapter. It now shows a 500 error when doing build.

Reproduction

Steps to reproduce: npm init svelte@next functions

Use TypeScript? … Yes Add ESLint for code linting? … Yes Add Prettier for code formatting? … Yes

cd functions npm install


Change adaptor to static in svelte.config.js import adapter from '@sveltejs/adapter-static';

Install the static adapter: npm install @sveltejs/adapter-static@next

Build project npm run build

npm run build

functions@0.0.1 build svelte-kit build

vite v2.8.0 building for production… ✓ 34 modules transformed. .svelte-kit/output/client/_app/assets/svelte-logo-87df40b8.svg 1.85 KiB .svelte-kit/output/client/_app/assets/fira-mono-greek-ext-400-normal-9e2fe623.woff2 7.33 KiB .svelte-kit/output/client/_app/assets/fira-mono-cyrillic-ext-400-normal-3df7909e.woff2 15.40 KiB .svelte-kit/output/client/_app/assets/fira-mono-latin-ext-400-normal-6bfabd30.woff2 11.10 KiB .svelte-kit/output/client/_app/assets/fira-mono-cyrillic-400-normal-c7d433fd.woff2 8.89 KiB .svelte-kit/output/client/_app/assets/fira-mono-greek-400-normal-a8be01ce.woff2 10.27 KiB .svelte-kit/output/client/_app/assets/fira-mono-latin-400-normal-e43b3538.woff2 15.90 KiB .svelte-kit/output/client/_app/assets/fira-mono-all-400-normal-1e3b098c.woff 75.55 KiB .svelte-kit/output/client/_app/manifest.json 2.51 KiB .svelte-kit/output/client/_app/pages/__layout.svelte-1fdcf5b9.js 4.76 KiB / gzip: 1.86 KiB .svelte-kit/output/client/_app/error.svelte-6f6d00da.js 1.56 KiB / gzip: 0.75 KiB .svelte-kit/output/client/_app/pages/index.svelte-92dd2217.js 4.08 KiB / gzip: 1.69 KiB .svelte-kit/output/client/_app/pages/about.svelte-64b29582.js 2.38 KiB / gzip: 1.09 KiB .svelte-kit/output/client/_app/pages/todos/index.svelte-0cc5f931.js 5.91 KiB / gzip: 2.40 KiB .svelte-kit/output/client/_app/chunks/singletons-a6a7384f.js 0.05 KiB / gzip: 0.07 KiB .svelte-kit/output/client/_app/start-f44d78f5.js 23.36 KiB / gzip: 7.95 KiB .svelte-kit/output/client/_app/assets/pages/todos/index.svelte-784042c1.css 3.70 KiB / gzip: 1.04 KiB .svelte-kit/output/client/_app/assets/pages/index.svelte-1d45bd0c.css 1.40 KiB / gzip: 0.50 KiB .svelte-kit/output/client/_app/assets/pages/about.svelte-bf4528fa.css 0.11 KiB / gzip: 0.10 KiB .svelte-kit/output/client/_app/chunks/vendor-ee294e9e.js 14.16 KiB / gzip: 6.04 KiB .svelte-kit/output/client/_app/assets/pages/__layout.svelte-15681802.css 4.96 KiB / gzip: 1.55 KiB vite v2.8.0 building SSR bundle for production… ✓ 36 modules transformed. .svelte-kit/output/server/manifest.json 2.15 KiB .svelte-kit/output/server/app.js 63.28 KiB .svelte-kit/output/server/entries/endpoints/todos/index.ts.js 1.23 KiB .svelte-kit/output/server/entries/pages/__layout.svelte.js 4.60 KiB .svelte-kit/output/server/entries/pages/error.svelte.js 0.72 KiB .svelte-kit/output/server/entries/pages/index.svelte.js 8.07 KiB .svelte-kit/output/server/entries/pages/about.svelte.js 1.30 KiB .svelte-kit/output/server/entries/pages/todos/index.svelte.js 5.84 KiB .svelte-kit/output/server/chunks/index-ee9fdf1a.js 4.24 KiB

Run npm run preview to preview your production build locally.

Using @sveltejs/adapter-static 500 /todos at file:///functions/node_modules/@sveltejs/kit/dist/chunks/index5.js:408:11 at visit (file:///functions/node_modules/@sveltejs/kit/dist/chunks/index5.js:585:4) at processTicksAndRejections (internal/process/task_queues.js:95:5)


What has changed:

  • Missing [uid].json.ts
  • Missing index.json.ts
  • New file index.ts

Logs

No response

System Info

System:
    OS: macOS 12.2
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 252.46 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.1 - /usr/local/bin/node
    Yarn: 1.22.14 - /usr/local/bin/yarn
    npm: 8.1.1 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 91.1.26.67
    Chrome: 98.0.4758.80
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.17 
    @sveltejs/adapter-static: ^1.0.0-next.26 => 1.0.0-next.26 
    @sveltejs/kit: next => 1.0.0-next.265 
    svelte: ^3.46.0 => 3.46.4

Severity

blocking all usage of SvelteKit

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
geoffrichcommented, Feb 16, 2022

I guess I don’t understand what the issue is here. Yes, you could build the demo app with the static adapter before. However, the built app was then non-functional, since you couldn’t interact with the todo list without the server handlers. It’s a good thing that you are now made aware at build time that the production app will not function properly. If you want to build the demo app, you need to use an adapter that supports server endpoints at runtime, which the static adapter does not. The build-time error is expected and desired in this case.

Is there a SvelteKit app besides the demo app that should work with the static adapter and no longer does post the introduction of shadow endpoints?

2reactions
indacocommented, Feb 16, 2022

UPDATE now both are on latest v275

  • update the svelte.config.js
...
kit: {
   trailingSlash: 'always',
   adapter: adapter(),
   prerender: {
	entries: ['*']
}
...
}
  • fixed the links on markdown (mdsvex) pages to avoid /404 during the build with adapter static

I have a couple of public websites ( sveltin.io and docs.sveltin.io ) using the static adapter.

Both work with sveltekit@1.0.0-next.264 and adaper-static@1.0.0-next.28

With sveltekit@1.0.0-next.265 and higher, the build process is ok but that the routing is affected (as per #3852 linked to this issue)

trailingSlash to any valid option does not work for me too.

adapter-static seems to me to be not aware of the “Pass trailingSlash config to adapters”(https://github.com/sveltejs/kit/pull/3820) like the vercel one

So far, I have to revert to sveltekit@1.0.0-next.264

Happy to share more info on it

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve error 500 on Azure web app?
Deployed to Azure Web App; The site works locally; When I deploy to Azure I get internal server error (500); I'm unable to...
Read more >
Http error 500 Invalid Query while calling ...
I am trying to do PUT calls via Postman to following endpoints of BizTalkManagementService Rest API in BizTalk 2020,.
Read more >
Once granted access, you can use the Figma API to
Endpoints allow you to request files, images, file versions, users, comments, team projects and project files. Once granted access, you can use the...
Read more >
Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, ...
Read more >
ThinkSystem RAID 930-x xGB Flash PCIe 12Gb Adapters2Gb ...
Nombre del archivoThinkSystem RAID 930-x xGB Flash PCIe 12Gb Adapters2Gb Adapters update BIOS and Firmware (For Linux) (InstallXML). Sistema operativo:.
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