expo / vscode-expo

Expo Tools keep you productive with debugging, IntelliSense, and prebuild previews
https://marketplace.visualstudio.com/items?itemName=expo.vscode-expo-tools
MIT License
433 stars 11 forks source link

"Certificate has expired" when activating the Expo schema #87

Closed byCedric closed 2 years ago

byCedric commented 2 years ago

Edit: in version 0.8.0+, the code that could trigger this has been removed and replaced with something more stable.


Description of the bug

There is a known issue related to certificates in the newer vscode. This might result in the following error:

image

Workarounds

There are currently two workarounds to avoid this issue, until vscode fixes the issue. After applying either of the workarounds, simply restart your vscode and the error should be gone.

From the vscode team

Currently, the recommended workaround from the vscode team would be to add "http.systemCertificates": false in your configuration. This would avoid the faulty root certificate and successfully pull in the schema.

After the schema was activated successfully, you can remove this option. We cache the schema to minimize the API calls.

With the Expo schema cache

If you aren't comfortable with disabling the system certificates, you can work around this issue by pre-populating the schema cache. This would be required for every major Expo SDK version your project(s) use.

$ expo init ./temporary --template expo-template-blank@44
$ cd temporary
$ expo doctor
$ cd ..
$ npx rimraf temporary

This creates an empty project using Expo SDK 44, we only need to execute $ expo doctor inside of that to download the Expo schema outside vscode. After you execute this, the schema is written to:

If you use other SDK versions, you can replace 44 with any major version you use.

# Linux
~/.cache/expo/schema-44.0.0.json

# MacOS
~/.expo/cache/schema-44.0.0.json

# Windows
%AppData%\Local\Expo\schema-44.0.0.json

Additional context

byCedric commented 2 years ago

Fixed in vscode versions 1.66+