You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nodejs_compat does not work with crypto.createSign beause the version of unenv has not implemented it yet.
I am trying to use the google sheets api. While this worked just fine with Firebase Functions on Node, it fails to work with Cloudflare Workers while using the "nodejs_compat" flag.
As you can see from this error message the problem is that it is relying on unenv for compatability, and this version library has not yet implemented crypto.createSign
Using googleapis v. 144.0.0 and hono v. 4.6.12 on MacOS
import{Hono}from"hono";import{google}from"googleapis";constapp=newHono();app.get("/",async(c)=>{constauth=newgoogle.auth.GoogleAuth({credentials: {// @ts-expect-errorprivate_key: c.env.SERVICE_ACCOUNT_KEY,// @ts-expect-errorclient_email: c.env.SERVICE_ACCOUNT_EMAIL,},scopes: ["https://www.googleapis.com/auth/spreadsheets","https://www.googleapis.com/auth/drive.file",],});const{ spreadsheets }=google.sheets({version: "v4",
auth,});const{ data }=awaitspreadsheets.values.get({// @ts-expect-errorspreadsheetId: c.env.SPREADSHEET_ID,range: "A3:AI3",});c.text("Errors before this");});
Results in the following error:
✘ [ERROR] Error: [unenv] crypto.createSign is not implemented yet!
at createNotImplementedError
(file:///Users/me/my-project/new-functions/node_modules/unenv/runtime/_internal/utils.mjs:22:10)
at Object.fn [as createSign]
(file:///Users/me/my-project/new-functions/node_modules/unenv/runtime/_internal/utils.mjs:26:11)
at Object.sign
(file:///Users/me/my-project/new-functions/node_modules/jwa/index.js:151:25)
at Object.jwsSign [as sign]
(file:///Users/me/my-project/new-functions/node_modules/jws/lib/sign-stream.js:32:24)
at GoogleToken._GoogleToken_requestToken
(file:///Users/me/my-project/new-functions/node_modules/gtoken/build/src/index.js:235:27)
at GoogleToken._GoogleToken_getTokenAsyncInner
(file:///Users/me/my-project/new-functions/node_modules/gtoken/build/src/index.js:180:97)
at GoogleToken._GoogleToken_getTokenAsync
(file:///Users/me/my-project/new-functions/node_modules/gtoken/build/src/index.js:160:173)
at GoogleToken.getToken
(file:///Users/me/my-project/new-functions/node_modules/gtoken/build/src/index.js:110:102)
at JWT.refreshTokenNoCache
(file:///Users/me/my-project/new-functions/node_modules/google-auth-library/build/src/auth/jwtclient.js:173:36)
at JWT.refreshToken
(file:///Users/me/my-project/new-functions/node_modules/google-auth-library/build/src/auth/oauth2client.js:187:24)
The text was updated successfully, but these errors were encountered:
Ok great, I imagine this would be a very useful feature. 👍 I was really loving the Cloudflare Workers DX (soo good and smooth) but unfortunately had to switch over to AWS Lambda for this.
The nodejs_compat does not work with crypto.createSign beause the version of
unenv
has not implemented it yet.I am trying to use the google sheets api. While this worked just fine with Firebase Functions on Node, it fails to work with Cloudflare Workers while using the "nodejs_compat" flag.
As you can see from this error message the problem is that it is relying on unenv for compatability, and this version library has not yet implemented
crypto.createSign
Using googleapis v. 144.0.0 and hono v. 4.6.12 on MacOS
Results in the following error:
The text was updated successfully, but these errors were encountered: