Comments (10)
@teovillanueva you're a legend. Feel free to make a PR or I'll just implement your changes this weekend.
from t3-app-router-edge-drizzle.
What version of pnpm and node are you using?
I'm not seeing this issue with these versions:
❯ pnpm -v
8.1.1
❯ node -v
v18.12.1
from t3-app-router-edge-drizzle.
❯ pnpm -v
8.2.0
❯ node -v
v18.15.0
❯ npm -v
v9.5.0
❯ yarn -v
v1.22.19
from t3-app-router-edge-drizzle.
I've updated to these versions and cannot reproduce this issue. Are you able to reproduce it in a StackBlitz?
from t3-app-router-edge-drizzle.
Interestingly, StackBlitz produced a different error:
error - Error [TypeError]: runtime.context.addEventListener is not a function
at createModuleContext (file:///home/projects/nbwivyklk.github/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/web/sandbox/context.js:314:21)
from t3-app-router-edge-drizzle.
Hi,
The issue comes from the library @paralleldrive/cuid2
. There's no native polyfill for crypto on edge runtime afaik.
from t3-app-router-edge-drizzle.
@miguelangelrm you're right. https://twitter.com/t3dotgg/status/1650363208501452802?s=46&t=gcUfMBapkwWetwiN_HjdZw
While it seems to build for me personally, I think I'm going to update this repo to use a cuid v1 package until the bundling polyfill kinks get worked out in the App Router. PR's welcome until I get to it!
from t3-app-router-edge-drizzle.
@SooditK let me know if this problem is fixed for you
from t3-app-router-edge-drizzle.
Hello, I fixed this with this patch-package diff.
patches/@noble+hashes+1.3.0.patch
diff --git a/node_modules/@noble/hashes/cryptoNode.js b/node_modules/@noble/hashes/cryptoNode.js
index 939525d..3038d91 100644
--- a/node_modules/@noble/hashes/cryptoNode.js
+++ b/node_modules/@noble/hashes/cryptoNode.js
@@ -1,6 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.crypto = void 0;
-const nc = require("node:crypto");
-exports.crypto = nc && typeof nc === 'object' && 'webcrypto' in nc ? nc.webcrypto : undefined;
+exports.crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
//# sourceMappingURL=cryptoNode.js.map
\ No newline at end of file
diff --git a/node_modules/@noble/hashes/esm/cryptoNode.js b/node_modules/@noble/hashes/esm/cryptoNode.js
index 4bac77a..a0dac2b 100644
--- a/node_modules/@noble/hashes/esm/cryptoNode.js
+++ b/node_modules/@noble/hashes/esm/cryptoNode.js
@@ -1,3 +1,2 @@
-import * as nc from 'node:crypto';
-export const crypto = nc && typeof nc === 'object' && 'webcrypto' in nc ? nc.webcrypto : undefined;
+export const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
//# sourceMappingURL=cryptoNode.js.map
\ No newline at end of file
diff --git a/node_modules/@noble/hashes/src/cryptoNode.ts b/node_modules/@noble/hashes/src/cryptoNode.ts
index 65d0853..9732af4 100644
--- a/node_modules/@noble/hashes/src/cryptoNode.ts
+++ b/node_modules/@noble/hashes/src/cryptoNode.ts
@@ -1,3 +1,3 @@
-import * as nc from 'node:crypto';
+declare const globalThis: Record<string, any> | undefined;
export const crypto =
- nc && typeof nc === 'object' && 'webcrypto' in nc ? (nc.webcrypto as any) : undefined;
+ typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
from t3-app-router-edge-drizzle.
@SooditK can you verify whether or not @teovillanueva's fix solves the problem for you? It's merged to main.
from t3-app-router-edge-drizzle.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from t3-app-router-edge-drizzle.