Challenges with deploying to netlify

Does anyone have any luck with deployment? I tried both the tutorial way and the netlify adapter. The netlify adapter allows the deployment to be successful but not able to serve the build files (index, app). with the static adapter, netlify says I need to use a node adapter instead of the static adapter.

Hey, I managed to deploy the static version of SvelteKit with the static adapter and also the pre-rendering option.

Although, I built locally then uploaded the files to the Netlify instance manually.

What I did notice, not sure if it is the same for your. But if you have pages that are dynamic and fetch data, you will get 404's most of the time even with pre-rendering unless you have a list of links that have the svelte:prefetch attribute.

If you set kit.prerender.pages array to have ['*', '/list', '/of/urls'] and those are the ones with the dynamic stuff then that will work.

Here is a my repo, it is deploying into Netlify GitHub - ReeceM/svelte-netlify-prismic-demo

Title and h1 comes from Prismic, hello-world

This is a page that has loaded the data https://optimistic-spence-e01837.netlify.app/page

1 Like

I am unable to build locally with the static adapter, I have to use the node adapter.
config.kit.adapter should be an object with an "adapt" method. See Docs • SvelteKit

Not sure if that's the way it's always meant to be. Also, unfortunately, with the manual upload of the file, I get the same 404's. Even tried adding the pretender options and svelte:prefetch. no luck yet.

I think the adapter for the static one only worked for me when I used the @next option on the install of it.

So npm i -D @sveltejs/adapter-static@next you need this version "^1.0.0-next.4", the default one that happens to install without a version constraint seems to have issues for some reason.

2 Likes

The site example I linked on the git repo is one that I put together that makes use of the static adapter. The same error you having is the one that I got the first time round.

In the example repo too though I have added an extra node script that prefetches all the possible doc types and renders an exported array to a JSON file that isn't included in source. Then at build time on Netlify, it pulls it in, uses and then exports the build directory.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.