Repository navigation
Description
Bug description
Description
We’re seeing inconsistent availability of the Web Crypto API depending on the environment. Specifically, crypto.randomUUID() works in some contexts but is undefined in others.
This appears to be tied to whether the page is running in a secure context.
Reproduction
Open app over HTTPS (or localhost):
crypto.randomUUID()
✅ Works as expected
Open app over internal HTTP hostname:
http://randomUrl.com
crypto.randomUUID()
❌ TypeError: crypto.randomUUID is not a function
Debug Info
running command in both windows
console.log(JSON.stringify({
isSecureContext,
hasCrypto: !!window.crypto,
hasRandomUUID: !!window.crypto?.randomUUID,
location: window.location.href
}));Result on HTTPs/localhost environment(localhost):
{"isSecureContext":true,"hasCrypto":true,"hasRandomUUID":true,"location":"http://localhost:51212/"}
Result on internal HTTP hostname::
{"isSecureContext":false,"hasCrypto":true,"hasRandomUUID":false,"location":"http://***:8084/"}
crypto.randomUUID() should be available in all supported environments where UUID generation is required.
Actual Behaviour
crypto.randomUUID() is unavailable when the app is served over non-secure HTTP (non-localhost), causing runtime errors.
Root Cause
The Web Crypto API (including randomUUID) is only available in secure contexts:
✅ HTTPS
✅ http://localhost
❌ arbitrary HTTP origins (e.g. internal hostnames)
Severity
Reproduction
This is based off hosting prisma behind a
Expected vs. Actual Behavior
Actual Behaviour
crypto.randomUUID() is unavailable when the app is served over non-secure HTTP (non-localhost), causing runtime errors.
Root Cause
The Web Crypto API (including randomUUID) is only available in secure contexts:
✅ HTTPS
✅ http://localhost
❌ arbitrary HTTP origins (e.g. internal hostnames)
Expected behaviour
No use of crypto package in prisma studio
Frequency
Consistently reproducible
Does this occur in development or production?
Only in development (e.g., CLI tools, migrations, Prisma Studio)
Is this a regression?
Yes, this wasn't an issue in prisma 6
Workaround
Downgrade to prisma 6
Prisma Schema & Queries
// Add relevant schema.prisma snippet// Add relevant Prisma Client queryPrisma Config
// Add your `prisma.config.ts`Logs & Debug Info
// Debug logs here
Environment & Setup
- OS:
- Database:
- Node.js version:
Prisma Version
// Prisma version output
Activity
SevInf commentedon May 11, 2026
Hi @fjdvchain
Non of the reproduction steps you are listing involve Prisma in any way. How do we fit into that? Prisma does not run in the browser.
fjdvchain commentedon May 11, 2026
@SevInf this would apply for any prisma studio implementation. Just spin up prisma studio on some random url like http://randomurl.com/ vs the localhost version.
If you'd like an actual reproduction let me know, but for DNS that would be hard for me to tell someone how to do
puneetdixit200 commentedon May 16, 2026
Hi maintainers, I’d like to investigate this. I can trace where Prisma depends on crypto.randomUUID(), add a safe fallback or environment-aware path, and include regression coverage.
aqrln commentedon Jun 4, 2026
Closing as wontfix, sorry. An ever increasing number of web platform features require secure context, it's a decision that browser vendors and W3C made, nothing we can do about it. I would expect most modern web applications to break in non-secure contexts nowadays.
We won't be adding unnecessary bloat or, worse, actively harmful fallbacks like a UUIDv4 misimplementation without WebCrypto, which would lead to frequent UUID collisions.
prisma studiois normally used on localhost, which is considered a secure context even over HTTP. If you need to deploy it on an internal network, then simply use HTTPS. You may find tools likemkcerthelpful.fjdvchain commentedon Jun 29, 2026
@aqrln yeah but I want to run this on internal internal networks. So now I just can't edit the database. This was possible before in previous versions of prisma studio. This is something you use to support.
aqrln commentedon Jul 6, 2026
And you can. Just use HTTPS.