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

crypto.randomUUID is not a function #14312

Closed
devenliu opened this issue Sep 11, 2023 · 12 comments · Fixed by #14371
Closed

crypto.randomUUID is not a function #14312

devenliu opened this issue Sep 11, 2023 · 12 comments · Fixed by #14371
Labels
Milestone

Comments

@devenliu
Copy link

devenliu commented Sep 11, 2023

Describe the bug

When I access the media library and upload a file, nothing happens and I get the error Uncaught TypeError: crypto.randomUUID is not a function in the console.

orchardproject/orchardcore-cms-linux:1.7.0

To Reproduce

Steps to reproduce the behavior:

  1. Enable Media feature
  2. Access Content/Media Library

Expected behavior

Can upload media files.

Screenshots

image

image

@devenliu
Copy link
Author

Debugging the OrchardCore.Cms.Web project in the solution in the source code through Visual Studio does not have this problem.

@sebastienros
Copy link
Member

Based on this doc you can check what browser version you need https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

Which one is that? Works locally for me (Edge). We might need a polyfill if not all modern browsers support it.

@sebastienros sebastienros added this to the 1.x milestone Sep 14, 2023
@sebastienros
Copy link
Member

/cc @dministro

@devenliu
Copy link
Author

Based on this doc you can check what browser version you need https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

Which one is that? Works locally for me (Edge). We might need a polyfill if not all modern browsers support it.

Edge - 116.0.1938.81 x64

@devenliu
Copy link
Author

It seems that only container images hosted on Docker Hub have this issue.

@sebastienros
Copy link
Member

That should not be related to this though, it doesn't make sense. Would be interesting to understand how. Someone else should try to repro it, should be easy with your repro steps.

@dministro
Copy link
Contributor

I'm not sure but this can be the reason from the crypto API documentation:
image

When you run the app from a docker container, the app is listening on http(80) and not https.
See in dockerfile:

ENV ASPNETCORE_URLS http://+:80

@sebastienros
Copy link
Member

That seems very possible, good catch!

@sebastienros
Copy link
Member

I verified it and this is it, tried in an F12 JS console for both https://glowingoldfunspell.neverssl.com/online/ and http://glowingoldfunspell.neverssl.com/online/ and got this:

image

image

@devenliu
Copy link
Author

@dministro @sebastienros
I think this should be the problem.
Thank you so much for your help.

@dministro
Copy link
Contributor

Do we need a workaround(polyfill) for this?

@sebastienros

@sebastienros
Copy link
Member

I think we should wrap this, we didn't say OC would not work without https.

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

Successfully merging a pull request may close this issue.

4 participants