Uuid: Version 7.0.0 not compatible with Azure Functions/AWS Lambda/Google Cloud Functions

Created on 25 Feb 2020  路  9Comments  路  Source: uuidjs/uuid

Most helpful comment

I have just released [email protected] which should fix this issue. If the problem remains for anyone please feel free to open a new issue.

And thanks @TrySound for the great work! 馃帀

All 9 comments

It's not just Azure. AWS lambda as well as google cloud functions, and therefore firebase cloud functions, have the same issue

Error: uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.

@evdama @jvpelt @VandalPaulius @ZebraFlesh could you please share more details about your Azure Functions/AWS Lambda/Google Cloud Functions setup with steps to reproduce the error?

My suspicion is that you are bundling code in a way that is designed to run in a browser environment, not in Node.js

So are any bundlers like webpack or rollup involved in your process?

I created a minimalistic PoC that shows that under normal circumstances using uuid in Cloud Functions works just well: https://github.com/ctavan/uuid-cloud-functions-poc

yes, I use rollup to bundle uuid, then use it like this in my server.js within express middleware:

import { v4 as uuidv4 } from 'uuid'

const setNonceMiddleware = ( request, response, next ) => {
  try {
    response.locals.nonce = uuidv4()
    next()
  } catch ( error ) {
    console.error ( 'error from setNonceMiddleware: ', error )
  }
}

@ctavan Here's a minimal repo with what I'm doing. master branch is set to [email protected]; upgrade to [email protected] to see failure. https://github.com/ZebraFlesh/uuid-serverless-poc

edit: I'm using webpack + serverless + serverless-offline

Thank you @ZebraFlesh. I think a fix is near: #380

So are any bundlers like webpack or rollup involved in your process?

I created a minimalistic PoC that shows that under normal circumstances using uuid in Cloud Functions works just well: https://github.com/ctavan/uuid-cloud-functions-poc

Yes, in my case I was using Webpack to bundle everything, but the target was set to node. Hopefully #380 will fix it

I have just released [email protected] which should fix this issue. If the problem remains for anyone please feel free to open a new issue.

And thanks @TrySound for the great work! 馃帀

Thanks much, working again for firebase cloud functions with node express middleware (code see above).

Thanks so much for the quick turn around! Confirmed on my end that my PoC is fixed with 7.0.1 馃檶

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrtnbroder picture mrtnbroder  路  6Comments

8bitjoey picture 8bitjoey  路  5Comments

josias-r picture josias-r  路  6Comments

nilfalse picture nilfalse  路  10Comments

nemoload picture nemoload  路  3Comments