rabbit_rabbitR
Denoβ€’3y agoβ€’
8 replies
rabbit_rabbit

InvalidData: No certificates found in cert file

Hello! Following up from a previous help post here,
helpFresh migrating from serveTls

I had been running against serveTls with these .crt and .key files, but now I'm seeing

error: Uncaught (in promise) InvalidData: No certificates found in cert file
    await Deno.serve(
               ^
    at listenTls (ext:deno_net/02_tls.js:72:40)
    at Object.serve (ext:deno_http/00_serve.js:593:16)
    at bootServer (https://deno.land/x/fresh@1.6.1/src/server/boot.ts:78:16)
    at startServer (https://deno.land/x/fresh@1.6.1/src/server/boot.ts:39:11)
    at dev (https://deno.land/x/fresh@1.6.1/src/dev/dev_command.ts:58:11)
    at eventLoopTick (ext:core/01_core.js:178:11)
    at async file:///Users/willweiss/dev/morehumaninternet/virtual-hospitals-africa/dev.ts:8:1


My fresh.config.ts ends like this

export default defineConfig({
  port,
  plugins: [tailwind()],
  cert: "./local-certs/localhost.crt",
  key: "./local-certs/localhost.key",
})


While my dev.ts file looks like this

#!/usr/bin/env -S deno run -A --watch=static/,routes/

import dev from '$fresh/dev.ts'
import config from './fresh.config.ts'

import "$std/dotenv/load.ts";

await dev(import.meta.url, './main.ts', config)


Even if I try to make a new cert via

openssl req -newkey rsa:2048 -nodes -keyout server.key -x509 -days 365 -out server.crt -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"


I see the same issue.

I'm running with the following prefix in both cases

DENO_TLS_CA_STORE=system deno run -A --unsafely-ignore-certificate-errors


Any help is appreciated!
Was this page helpful?