-
-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 7.0.0 not compatible with Azure Functions/AWS Lambda/Google Cloud Functions #378
Comments
It's not just Azure. AWS lambda as well as google cloud functions, and therefore firebase cloud functions, have the same issue
|
@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 |
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 )
}
} |
Probably will fix uuidjs#378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd.
Probably will fix uuidjs#378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd.
Probably will fix uuidjs#378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd. https://webpack.js.org/configuration/resolve/#resolvemainfields https://github.com/rollup/plugins/tree/master/packages/node-resolve#browser https://github.com/defunctzombie/package-browser-field-spec
@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 |
Probably will fix #378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd. https://webpack.js.org/configuration/resolve/#resolvemainfields https://github.com/rollup/plugins/tree/master/packages/node-resolve#browser https://github.com/defunctzombie/package-browser-field-spec
Probably will fix uuidjs#378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd. https://webpack.js.org/configuration/resolve/#resolvemainfields https://github.com/rollup/plugins/tree/master/packages/node-resolve#browser https://github.com/defunctzombie/package-browser-field-spec
Probably will fix uuidjs#378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd. https://webpack.js.org/configuration/resolve/#resolvemainfields https://github.com/rollup/plugins/tree/master/packages/node-resolve#browser https://github.com/defunctzombie/package-browser-field-spec
Yes, in my case I was using Webpack to bundle everything, but the target was set to |
Fixes #378 Currently main field is used for node and module for browser build. This is not entierly correct. Webpack can be used to build node apps. Though module is always preferred over main. For browser versions there is a special field. In this diff I added esm support for both node and browser. rollup-plugin-node-resolve look at browser field as well and prefer it to bundle umd. https://webpack.js.org/configuration/resolve/#resolvemainfields https://github.com/rollup/plugins/tree/master/packages/node-resolve#browser https://github.com/defunctzombie/package-browser-field-spec
I have just released 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 🙌 |
References:
The text was updated successfully, but these errors were encountered: