Unable to Deploy Unless using CLI Deploy

Hello. I'm able to run and even deploy my app when building locally (e.g. npx wrangler pages . and npx wrangler pages deploy .). However, the automatic deploys runs into an error after build and during deploy due to an error from one of the NPM node_modules. I think it's due to process.stderr being accessed improperly or being polyfilled improperly by unenv. However, I don't see a way to access the build artifacts that cloudflare creates and so cannot debug this issue. Any help would be appreciated. Thank you. Removed the other details as I've figured out a workaround. See first response. Error:
14:19:17.224 ✨ Upload complete!
14:19:20.535 Success: Assets published!
14:19:21.617 Error: Failed to publish your Function. Got error: Uncaught TypeError: Cannot convert object to primitive value
at functionsWorker-0.5057992545540486.js:9620:101 in isEnabled
at functionsWorker-0.5057992545540486.js:9623:35 in refresh
at functionsWorker-0.5057992545540486.js:9665:13 in ../node_modules/google-logging-utils/build/src/colours.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
at functionsWorker-0.5057992545540486.js:9721:21 in ../node_modules/google-logging-utils/build/src/logging-utils.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
at functionsWorker-0.5057992545540486.js:9986:18 in ../node_modules/google-logging-utils/build/src/index.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
at functionsWorker-0.5057992545540486.js:10034:18 in ../node_modules/gcp-metadata/build/src/index.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
14:19:17.224 ✨ Upload complete!
14:19:20.535 Success: Assets published!
14:19:21.617 Error: Failed to publish your Function. Got error: Uncaught TypeError: Cannot convert object to primitive value
at functionsWorker-0.5057992545540486.js:9620:101 in isEnabled
at functionsWorker-0.5057992545540486.js:9623:35 in refresh
at functionsWorker-0.5057992545540486.js:9665:13 in ../node_modules/google-logging-utils/build/src/colours.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
at functionsWorker-0.5057992545540486.js:9721:21 in ../node_modules/google-logging-utils/build/src/logging-utils.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
at functionsWorker-0.5057992545540486.js:9986:18 in ../node_modules/google-logging-utils/build/src/index.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
at functionsWorker-0.5057992545540486.js:10034:18 in ../node_modules/gcp-metadata/build/src/index.js
at functionsWorker-0.5057992545540486.js:25:50 in __require
1 Reply
javascript_is_wack
javascript_is_wackOP11h ago
Looks like this is already a bug for this. I'm assuming this impacts all Google npm packages. It is the polyfill for the process and apparently this can be patched out manually as a workaround. https://github.com/googleapis/js-genai/issues/324
GitHub
Issue with importing from @google/genai/node fails in Cloudflare ...
Problem When importing directly from @google/genai/node in a Cloudflare Worker, the application fails due to limited Node.js compatibility in the Workers environment. The specific error occurs in t...

Did you find this page helpful?