D
Deno

help

Can use the --cert flag in the command line, but not in deno.json

CCaptainBeefPanties10/19/2023
I am trying to run my deno program with the following command: deno run -A --cert ~/tmp/ca.crt main.ts This works fine. However, if I put this command in my deno.json, it can no longer find the certificate:
An error occurred during route handling or page rendering. Error: Failed opening CA file: No such file or directory (os error 2)
An error occurred during route handling or page rendering. Error: Failed opening CA file: No such file or directory (os error 2)
My deno.json relevant line:
"start": "deno run -A --cert=/home/jlcarveth/tmp/ca.crt --watch=static/,routes/ dev.ts"
"start": "deno run -A --cert=/home/jlcarveth/tmp/ca.crt --watch=static/,routes/ dev.ts"
So why can Deno find the cert no problem if I run the command from the CLI, but not via deno.json? Anyone have any idea? Can I somehow improve / add details to my question so that it gets some attention? I've posted numerous times asking for help on different topics, and have never gotten a single reply. It's not necessarily that it's being run from deno.json, but the inclusion/omission of the watch flag which seems to break things.
DAHDeno AI Helper10/19/2023
Based on the documentation, it doesn't explicitly mention that the --cert flag can be used in the deno.json file. The --cert flag is typically used in the command line interface (CLI) to specify a certificate for the CA that signed the server's TLS certificate. The error message you're seeing suggests that the file path to the certificate is not being found when you're running the command from your deno.json file. This could be due to a difference in how paths are resolved when running commands from the CLI versus from the deno.json file. However, the documentation doesn't provide a clear answer to why this discrepancy occurs. It might be helpful to double-check the file path to your certificate and ensure it's correct. If the issue persists, you might want to consider reaching out to the Deno community or checking the Deno GitHub issues for similar problems.
LLeokuma10/19/2023
If you're not missing anything in your analysis, it could be a bug in Deno. I would test adding the certificate folder to watch just to see what happens

Looking for more? Join the community!