@google-cloud/storage version: 2.5.0I have recently started seeing the following error when trying to get a signed url:
SubtleCrypto not found. Make sure it's an https:// website.
Following the stack trace, it seems like the node library is trying to call some sort of browser crypto library - it looks like this:
at new BrowserCrypto(C:\...\node_modules\google-auth-library\build\src\crypto\browser\crypto.js
I've reverted back to version 2.3.0 of the library and the bug went away, so it seems as it if was introduced somewhere between 2.3 and 2.5.
Hi @artemzakharov. I tried both the examples in the documentation, they worked for me. Can you please provide the exact code you are trying with or the complete error you are getting?
Greetings @artemzakharov! Are you by chance running your code in electron, a chrome app, or some other non-nodejs native environment?
Hey guys, I updated back to 2.5.0 to re-create the issue and have found that it's no longer occurring... no idea what changed, but I can no longer reproduce it either, so I suppose that's a good thing! I'll re-open the issue if it starts showing up again.
I have encountered this issue on 2.5.0.
SubtleCrypto not found. Make sure it's an https:// website.
at new BrowserCrypto (node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/crypto/browser/crypto.js:40:19)
at Object.createCrypto (node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/crypto/crypto.js:23:16)
at GoogleAuth.<anonymous> (node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js:629:37)
at fulfilled (node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js:19:58)
I get it from running a test written in typescript with jest and ts-jest. our tsconfig is:
{
"compilerOptions": {
"module": "commonjs",
"outDir": "build",
"rootDir": "src",
"strict": true,
"inlineSourceMap": true,
"target": "es2017",
"lib": ["es2017", "esnext.asynciterable", "dom"],
"noImplicitAny": false
},
"include": [
"./src/"
]
}
I'm using jest to test my firebase functions and hit the same issue when calling getSignedUrl, from what I can tell all my configuration is setup to properly talk with the storage service.
Going to go ahead and re-open the issue since it looks like others are running into this.
@bag-man @mpalmerlee, Please test with the latest version (3.0.x) and see if the same issue is still occurs
๐ hey folks, I think I fixed this one. It does require the latest version of google-auth-library to be installed, so if you wouldn't mind:
$ rm -rf node_modules package-lock.json
$ npm install
And try again :)
Thanks @vishald123 and @JustinBeckwith I'll give it a try, I'm using the getSignedUrl method through the firebase-admin library, so I might have to do some package.json gymnastics to get the correct versions.
Hmmm, I'm having trouble forcing firebase-admin to use @google-cloud/storage version ^3.0.0, if I try to force it through the package-lock.json file it shows up as invalid and fails to load the library.
With my current configuration, here is the results of npm list google-auth-library:
โโโฌ [email protected]
โโโฌ @google-cloud/[email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
โโโฌ @google-cloud/[email protected]
โโโฌ @google-cloud/[email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โโโ [email protected]
Yar. I submitted this to pull it all up to date:
https://github.com/firebase/firebase-admin-node/pull/588
Thank you @JustinBeckwith! I've subscribed to that PR, once it is released I'll be able to test this.
firebase/firebase-admin-node#588
I tried update the the package of storage to v 3++ still not working. or Is it about IAM in google cloud?
@mpalmerlee does it work fine with the new release?
@modernduck can you please try with the new release as well.
Also have you tried loading everything fresh as mentioned above?
$ rm -rf node_modules package-lock.json
$ npm install
@AVaksman, the upgraded version does fix the error for me, thank you!
To upgrade I just issued:
npm upgrade firebase-admin
Most helpful comment
@AVaksman, the upgraded version does fix the error for me, thank you!
To upgrade I just issued:
npm upgrade firebase-admin