Skip to content

Add FAQ not about randomUUID related error. #155

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

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,37 @@ for the main thread to call functions defined in the worker in a non-blocking
manner, thus allowing the worker to also work in an unblocked manner and react
to such calls. We have resolved the mutual deadlock.

### TypeError: crypto.randomUUID is not a function

If PyScript fails to start and you look in the browser console, you may
find the following error:

!!! failure

```
main.js:43 Uncaught TypeError: crypto.randomUUID is not a function
at main.js:43:26
```

#### When

This happens because PyScript uses the `crypto.randomUUID` function, and the
web page isn't served correctly.

#### Why

This error is _created by the browser_ because `crypto.randomUUID` requires a
secure context or localhost to use the latest web standards that are part of
PyScript's core (such as `crypto.randomUUID`).

Put simply, your code should be served from a domain secured
with TLS (i.e. the domain name starts with `https` - use a service like
[let's encrypt](https://letsencrypt.org/) to address this) or from `localhost`
if developing and viewing your site on your development machine.

This is something PyScript can't fix. Rather, it's how the web works and you
should always ensure your code is served in a secure manner.

## Helpful hints

This section contains common hacks or hints to make using PyScript easier.
Expand Down