reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
19.28k stars 1.09k forks source link

SSL Certificate Failure (Reflex Init) #3748

Open jacksonwoody opened 1 month ago

jacksonwoody commented 1 month ago

Describe the bug Running on Ubuntu 22.04, Python 3.11, I need to provide an SSL Certificate file, otherwise various stages of creating an app (reflex init) raise exceptions due to my company's security policies. I've set SSL_CERT_FILE as an environment variable pointing to my valid CA certificate but it keeps failing:

An error occurred while downloading fnm package: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)

I think it's failing at a threading part of the reflex init step so it's not giving me any more traceback information. I would love some help/suggestions as I wanted to give reflex a try, sadly I can't even get hello world working due to this...

To Reproduce Steps to reproduce the behavior:

Expected behavior For the installation to work, create a project and then run reflex run successfully.

Specifics (please complete the following information):

masenf commented 1 month ago

Seems like this is due to bun install not respecting SSL_CERT_FILE.

There are a couple of workarounds in this thread https://github.com/oven-sh/bun/issues/271

Environment variable NODE_TLS_REJECT_UNAUTHORIZED=0

This will just ignore the cert error, which is not great, but seems to be what companies with MitM proxies encourage their users to do all the time, so probably fine.

Later in the thread someone mentions

The latest version does load /etc/ssl/certs/ca-certificates.crt on Ubuntu without any special configuration

So that might be something to try... if that doesn't work, we do have a PR in the queue that upgrades to the latest bun version that should be coming in this week.