Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1486

Could not convert symbol to string error after adding https certificate

$
0
0

I am trying to fetch data from asp.net core api to svelte page. I got a self signed certificate error:

TypeError: fetch failed    at node:internal/deps/undici/undici:12500:13    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {  [cause]: Error: self-signed certificate      at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)      at TLSSocket.emit (node:events:520:28)      at TLSSocket._finishInit (node:_tls_wrap:1085:8)      at ssl.onhandshakedone (node:_tls_wrap:871:12)      at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {    code: 'DEPTH_ZERO_SELF_SIGNED_CERT'  }}

Next I used mkcert to create a certificate and key inside the project directory and then I updated vite.config.ts to look like this:

import { sveltekit } from '@sveltejs/kit/vite';import { defineConfig } from 'vite';import fs from 'fs';export default defineConfig({    plugins: [sveltekit()],    server: {        https: {            key: fs.readFileSync(`${__dirname}/cert/key.pem`),            cert: fs.readFileSync(`${__dirname}/cert/cert.pem`)        }    }});

Finally, when I start the sveltekit server I am greeted with this error in the browser:

TypeError: Could not convert argument of type symbol to string.    at webidl.converters.DOMString (node:internal/deps/undici/undici:1940:15)    at webidl.converters.ByteString (node:internal/deps/undici/undici:1945:35)    at Object.record<ByteString, ByteString> (node:internal/deps/undici/undici:1857:30)    at webidl.converters.HeadersInit (node:internal/deps/undici/undici:3397:67)    at Object.RequestInit (node:internal/deps/undici/undici:1914:21)    at new Request (node:internal/deps/undici/undici:4821:34)    at getRequest (file:///C:/path/to/project/Client/node_modules/@sveltejs/kit/src/exports/node/index.js:107:9)    at file:///path/to/project/Client/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:2

BTW mkcert -install informed me that firefox is not supported on my platform.

Setting up the certificate for dev environment seems like a simple task, but I've been frustrated that I can't actually develop the website for quite some time now.

I want to fetch data from asp.net core api to a sveltekit front end, but I can't, because I get errors from which I can't make any sense.


Viewing all articles
Browse latest Browse all 1486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>