I have a strange thing going on. I'm using sveltekit for the first time and in my project I was going to call an api to fetch data and got error: request to ' ' failed, reason: self signed certificate in certificate chain. And this was in the sveltekit loading function. When I did the same thing in onMount in a component it works like a charm.
So I decided to start a new project from scratch using the sveltekit demo template. And without changing anything going to the todo page and getting the same thing:
request to https://api.svelte.dev/todos/98e351d failed, reason: self signed certificate in certificate chain FetchError: request to https://api.svelte.dev/todos/98e351d failed, reason: self signed certificate in certificate chain at ClientRequest. (file:///C:/Users/myuser/Desktop/my-app/node_modules/@sveltejs/kit/dist/install-fetch.js:6246:11) at ClientRequest.emit (node:events:390:28) at TLSSocket.socketErrorListener (node:_http_client:447:9) at TLSSocket.emit (node:events:390:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21)
And shouldn't the demo template work without any certificate? So decided to start a demo template on another computer. And there the todo page works as it should. Without any error. I have looked around for someone with a similar problem and there is a lot of people getting self signed certificate error but not related to sveltekit or similar to my problem.
Any idea? Thanks.