Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging Expo app in VSCode causes a certificate expired error. #1679

Closed
BlueDevil2k6 opened this issue Oct 1, 2021 · 13 comments
Closed

Debugging Expo app in VSCode causes a certificate expired error. #1679

BlueDevil2k6 opened this issue Oct 1, 2021 · 13 comments

Comments

@BlueDevil2k6
Copy link

BlueDevil2k6 commented Oct 1, 2021

🐛 What is the bug? How can we reproduce it?

Please put here any steps, code or any information that can help us
reproduce the error on our side so we can fix it:

  1. Debug in Exponent
  2. Launch Expo Go using the QR code

Some additional details. If I launch directly from CLI 'expo start -c', app is able to run properly. I also created a brand new project from scratch using 'expo init' and simply ran the basic tabbed scaffold app and same issue occurred.

Expected behavior

App runs on the device as normal.

Debug output

Debug Console

Launching the application
Attaching to the application
Starting debugger app worker.
Established a connection with the Proxy (Packager) to the React Native application

React Native output channel

Checking if this is an Expo app......
[Info] Packager is already running.

[Info] Prewarming bundle cache. This may take a while ...

[Info] Building and running application.

No issue with doctor-config-json-not-readNo issue with doctor-watchman-versionNo issue with doctor-problem-checking-watchman-versionNo issue with doctor-unversionedNo issue with doctor-versions-endpoint-failedNo issue with doctor-invalid-sdk-versionNo issue with doctor-schema-validationNo issue with doctor-validate-asset-fieldsNo issue with doctor-schema-validation-exceptionNo issue with doctor-no-react-native-in-package-jsonNo issue with doctor-legacy-async-storageNo issue with doctor-react-native-not-installed[Info] Enable JS Debugging

[Info] Packager is already running.

--- Above is what runs before the Expo Go app connects, below is what pops up after the Expo Go app connects ---

No issue with doctor-config-json-not-readNo issue with doctor-watchman-versionNo issue with doctor-problem-checking-watchman-versionNo issue with doctor-unversioned[Error] Error: certificate has expired
    at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:932:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)

No issue with doctor-versions-endpoint-failedNo issue with doctor-invalid-sdk-versionNo issue with doctor-schema-validationNo issue with doctor-validate-asset-fieldsNo issue with doctor-schema-validation-exceptionNo issue with doctor-no-react-native-in-package-jsonNo issue with doctor-legacy-async-storageNo issue with doctor-react-native-not-installed

Developer Tools console
Below are multiple errors:

(node:25548) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use `Code Helper (Renderer) --trace-deprecation ...` to show where the warning was created)

TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope source.js.

TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope source.yaml.

console.ts:137 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot set property 'reactNativeVersionWarnings' of undefined

console.ts:137 [Extension Host] stack trace: TypeError: Cannot set property 'reactNativeVersionWarnings' of undefined

 Cannot set property 'reactNativeVersionWarnings' of undefined: TypeError: Cannot set property 'reactNativeVersionWarnings' of undefined

log.ts:301   ERR s.tmpDir is not a function: TypeError: s.tmpDir is not a function

Environment

Please tell us about your system and your project:

  • npx react-native doctor or npx expo doctor if your project is using Expo:
nix expo doctor
🎉 Didn't find any issues with the project!
  • envinfo:
  System:
    OS: macOS 11.6
    CPU: (8) arm64 Apple M1
    Memory: 132.09 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.9.1 - /opt/homebrew/bin/node
    Yarn: 1.22.11 - /opt/homebrew/bin/yarn
    npm: 7.21.1 - /opt/homebrew/bin/npm
    Watchman: 2021.09.27.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.10.2 - /opt/homebrew/lib/ruby/gems/3.0.0/bin/pod
    Homebrew: 3.2.14 - /opt/homebrew/bin/brew
    pip3: 21.2.4 - /opt/homebrew/bin/pip3
    RubyGems: 3.2.22 - /opt/homebrew/opt/ruby/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.32.0 - /opt/homebrew/bin/git
    Clang: 13.0.0 - /usr/bin/clang
  Servers:
    Apache: 2.4.48 - /usr/sbin/apachectl
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7583922
    Nano: 2.0.6 - /usr/bin/nano
    VSCode: 1.60.2 - /usr/local/bin/code
    Vim: 8.2 - /usr/bin/vim
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Perl: 5.30.2 - /usr/bin/perl
    PHP: 7.3.29 - /usr/bin/php
    Python: 2.7.16 - /usr/bin/python
    Python3: 3.9.7 - /opt/homebrew/bin/python3
    Ruby: 3.0.2 - /opt/homebrew/opt/ruby/bin/ruby
  Databases:
    SQLite: 3.32.3 - /usr/bin/sqlite3
  Browsers:
    Brave Browser: 92.1.28.106
    Chrome: 94.0.4606.61
    Safari: 15.0
  • React Native Tools extension version: v1.7.0
  • Expo SDK version (if applicable): SDK 42
@superandrew
Copy link

I was coming here to report the same problem

@RedMickey
Copy link
Contributor

Hi @BlueDevil2k6 @superandrew and thanks for reporting. Under the hood the extension uses xdl package to prepare Expo debugging. This package sends some requests to the Expo server while preparing Expo app for debugging, which causes the certificate error.
We found out that this issue could be related to issues with Let's Encrypt certificates expiring in VS Code (microsoft/vscode#134244) and Electron (electron/electron#31212).
We are tracking issues in those repos and believe this issue will be fixed in the nearest VS Code Insiders versions.
We'll let you know if we find any workaround before the issue is fixed in VS Code.

@RedMickey RedMickey added the expo label Oct 1, 2021
@superandrew
Copy link

thank you @RedMickey. I noticed there is no open issues on expo-cli about this. Is this because there is nothing that can be done on expo-cli side?

@RedMickey RedMickey self-assigned this Oct 4, 2021
@RedMickey
Copy link
Contributor

@superandrew It seems that this issue is more Electron specific. It's fixed in the recent version of Electron, but could persists in previous versions. So, we opened a question about updating Let’s Encrypt root certificate in Expo.
The issue in VS Code is also resolved. We built VS Code from sources and could debug an Expo app without problems. I think the fix will be available in Insiders version soon.

@RedMickey
Copy link
Contributor

@superandrew @BlueDevil2k6 The issue is fixed in the latest version of VS Code Insiders. Could you please try it out to check if it works for you?

@BlueDevil2k6
Copy link
Author

BlueDevil2k6 commented Oct 6, 2021

Thanks for following up on this. I've confirmed that this issue no longer appears in VS Code Insiders build 1.61.0-insider.

Version: 1.61.0-insider (Universal)
Commit: 2dc8b9580809148e312356852affc4b8d4feb7da
Date: 2021-10-06T08:24:49.272Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

What's the ETA on 1.61 making it as the official release?

@RedMickey
Copy link
Contributor

@BlueDevil2k6 According to this plan, the approximate release date is October 6, 2021. So, I think VS Code v1.61 stable will be released soon (maybe within this or next week).

@RedMickey
Copy link
Contributor

@BlueDevil2k6 @superandrew New stable version 1.61 of VS Code has been released. This version includes the fix for the certificate issue, so after updating VS Code editor to the new version, Expo debugging should work without problems.

@artus
Copy link

artus commented Jan 1, 2022

Hi

I still have this issue, with vscode version 1.63.2 (user setup).

Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0

React Native Tools: v1.8.1
Expo SDK: 44
$ npx expo doctor
[17:42:34] � Didn't find any issues with the project!

I get the following output:

[Error] Error: certificate has expired
    at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:932:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)

This is my launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
  
    {
      "name": "Debug in Exponent",
      "cwd": "${workspaceFolder}",
      "type": "reactnative",
      "request": "launch",
      "platform": "exponent",
      "expoHostType": "lan"
    }
  ]
}

@RedMickey
Copy link
Contributor

Hi @artus and thanks for reporting. It seems that the certificate issue is related to this issue in VS Code and Electron. According to this comment the problem should be fixed after updating Electron to version 16 in VS Code.
For now as a workaround I would suggest following the solution proposed in this comment. I tried it out and was able to start Expo debugging on Windows.

@RedMickey RedMickey reopened this Jan 5, 2022
@artus
Copy link

artus commented Jan 5, 2022

Thanks, that workaround seems to fix it!

@RedMickey RedMickey removed their assignment Mar 30, 2022
@JiglioNero
Copy link
Contributor

This bug doesn't seem to reproduce in the latest VSCode v1.66, so I'm closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants