Error: load must return a value except for page fall through on SvelteKit app

Netlify app site name: https://admiring-torvalds-48d875.netlify.app

Works perfect on Local. So it builds successfully with no errors on Netlify, but when you go to the link on Netlify I’m getting this error:

pages/__layout.svelte-75150560.js - load must return a value except for page fall through

** This could be a SvelteKit issue because I know they just changed something about the ‘load’ function and I would have posted there except it works fine local upon npm run dev.

GitHub repo:

Any time spent I thank ya :slight_smile:

Hi @Fourwhitesocks

The difference between npm run dev and building on Netlify is the latter uses @sveltejs/adapter-netlify which creates a render.js function which all page requests are handled by. If you download the deployed files, you can see what that looks like

It is possibly an issue with SvelteKit, or perhaps with the netlify-adapter (which is maintained by the same developers.)

Ok thank you for all of that! I must be missing something … or maybe this is just an example buy why does your red arrow point at something from July 29?? Or are you just giving me an example of where to look?

  • I have the: import adapter from ‘@sveltejs/adapter-netlify’ in my svelte.config.js file already?
  • In my Netlify site dash it even says that the site deployed successfully…

Not finding any Published or Locked deploy anywhere… this is not set as locked? I must not understand :confused:

Thank you again!

Yes, it is an example image, indicating to click the little green arrow that the big red arrow is pointing to :slight_smile:

You won’t necessarily see a Published or Locked deploy, again this is a demonstration. In the deploys (https://app.netlify.com/sites/admiring-torvalds-48d875/deploys) you will see a list similar to this

Click on the latest deploy (which will likely say Published) then the green download arrow at indicated previously.

Yes, it does, because this is not a build-time error, it is a run-time error.

I don’t believe (though can find no definitive information) the adapter is run during development (e.g. npm run dev) rather only when the site it built (e.g. npm run build).

Edit
If you run npm run build locally, the output you see should match that of Netlify. You have you Netlify CLI installed, you can use that to debug locally too.

OK gotcha on the example image… I wondered lol!
Also gotcha it being a run-time error too; thank you!

If I am understanding it correctly the adapter does only run on build. I will try doing the npm run build and see… no I don’t have the Netlify CLI installed yet … :confused: I am paranoid that it will mess things up … :roll_eyes:

I’m good at messing things up too! Always fun fixing though (IMHO) :smiley:

I know agreed, but happy it runs locally… I’m getting closer as now the error says something different; obviously it’s something in my codebase cuz now upon deploy it just says: Error: load function must return a value… I will keep working on it !

Fixed it!

It was a dumb mistake on my part! Hope this might help someone… like a bad little developer I forgot to add my environment variable into the site’s Netlify Build & Deploy Environment Variables … lol duh!

:stuck_out_tongue_winking_eye: :upside_down_face:

2 Likes

Hey there, @Fourwhitesocks :wave:

Not dumb at all! Thanks for coming back and sharing your solution-- it will definitely help future members who encounter something similar.

Happy building! :netliconfetti: