8000 Merge pull request #155 from pyscript/randomUUID · danyeaw/pyscript-docs@f1438ae · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1438ae

Browse files
authored
Merge pull request pyscript#155 from pyscript/randomUUID
Add FAQ not about randomUUID related error.
2 parents 86d69a8 + 0ae1660 commit f1438ae

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/faq.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,37 @@ for the main thread to call functions defined in the worker in a non-blocking
436436
manner, thus allowing the worker to also work in an unblocked manner and react
437437
to such calls. We have resolved the mutual deadlock.
438438

439+
### TypeError: crypto.randomUUID is not a function
440+
441+
If PyScript fails to start and you look in the browser console, you may
442+
find the following error:
443+
444+
!!! failure
445+
446+
```
447+
main.js:43 Uncaught TypeError: crypto.randomUUID is not a function
448+
at main.js:43:26
449+
```
450+
451+
#### When
452+
453+
This happens because PyScript uses the `crypto.randomUUID` function, and the
454+
web page isn't served correctly.
455+
456+
#### Why
457+
458+
This error is _created by the browser_ because `crypto.randomUUID` requires a
459+
secure context or localhost to use the latest web standards that are part of
460+
PyScript's core (such as `crypto.randomUUID`).
461+
462+
Put simply, your code should be served from a domain secured
463+
with TLS (i.e. the domain name starts with `https` - use a service like
464+
[let's encrypt](https://letsencrypt.org/) to address this) or from `localhost`
465+
if developing and viewing your site on your development machine.
466+
467+
This is something PyScript can't fix. Rather, it's how the web works and you
468+
should always ensure your code is served in a secure manner.
469+
439470
## Helpful hints
440471

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

0 commit comments

Comments
 (0)
0