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

Simple-chat is successfully deployed on the PC, an error occurs:Init error, TypeError: crypto.randomUUlD is not a function when I accesses the web port using the smart phone browser #338

Open
lebron8dong opened this issue Mar 18, 2024 · 1 comment

Comments

@lebron8dong
Copy link

image

PC:Google canary
phone:Google

@felladrin
Copy link

It happens because you can't access crypto in the browser when running through http (insecure context). Note that this rule doesn't apply for http://localhost nor http://127.0.0.1.
And by your screenshot, you're accessing http://10.203.161.238.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Crypto#usage_notes

In general, you probably should just treat Crypto as available only on secure contexts.

Possible solutions are:

  • Run a local https server - you can use a self-signed certificate.
  • Run it through a tunnel, like localtunnel, which gives you an https URL to access your app.

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

No branches or pull requests

2 participants