5

I'm facing an issue with my SvelteKit app deployed on Netlify that if I load the app and then leave the page inactive for several minutes, at some point it breaks, if I try to navigate or do stuff it gets stuck, and it seems like is not able to get the components, but at some point it eventually load, but it takes forever (like minutes). Screenshot attached is what I get after trying to navigate to a page by clicking on a button.

Here is the Sveltkit config:

import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    // Consult https://github.com/sveltejs/svelte-preprocess
    // for more information about preprocessors
    preprocess: preprocess({
        postcss: true
    }),

    kit: {
        adapter: adapter(),
    }
};

export default config;

enter image description here

Any clue?

Gum Rick
  • 205
  • 2
  • 13
  • post your config. – chovy Nov 21 '22 at 15:16
  • @chovy added the config – Gum Rick Nov 21 '22 at 15:29
  • if you need ssr then you'll want `adapter-node` – chovy Nov 21 '22 at 16:01
  • @chovy how this can have anything to do with the fact that if I keet a page idle for too long it gives me this issue? Cause in general the app is working, is just this idle thing that I explained above that causes problems. – Gum Rick Nov 24 '22 at 21:56
  • you'd have to look at what's using up CPU power in the debugger profiler. – chovy Nov 24 '22 at 22:00
  • @GumRick It appears to be some problem on netlify's part. What is clearly stated in the error message is that, the dynamically imported js files go 404 not found. – hackape Nov 28 '22 at 06:05
  • 1
    My theory is that netlify recycles your deployed instance after some time of inactivity, and fails to wake up later to handle those requests. This could happen if their wake up event is only triggered by visit to certain paths, which for whatever reason don't include `/_app/...`. – hackape Nov 28 '22 at 06:17
  • 1
    I suggest these steps to test out my theory. __1)__ Note down your path to JS file e.g., `https://{{host}}/_app/immutable/chunks/{{hash}}.js`. __2)__ Leave the page inactive to let netlify "go sleep", then visit the JS path in another tab from address bar, I expect this to be 404. __3)__ Now visit your home page, expected to be 200 ok. __4)__ visit the JS file path from address bar again, which should work fine now. If things go exactly like I speculate, then I think my theory got proven, and you should contact netlify for help, cus this is obviously their problem. – hackape Nov 28 '22 at 06:25

0 Answers0