Skip to content
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

[Bug]: @google-cloud/storage versions above 7.0.0 are broken #800

Closed
daem-on opened this issue Feb 1, 2025 · 6 comments
Closed

[Bug]: @google-cloud/storage versions above 7.0.0 are broken #800

daem-on opened this issue Feb 1, 2025 · 6 comments

Comments

@daem-on
Copy link

daem-on commented Feb 1, 2025

Problem description

When using @google-cloud/storage with an npm: specifier, deployment fails with this message:

The deployment failed: UNCAUGHT_EXCEPTION

TypeError: Cannot read properties of undefined (reading 'GOOGLE_SDK_NODE_LOGGING')
    at Object.log (file:///node_modules/.deno/[email protected]/node_modules/google-logging-utils/build/src/logging-utils.js:356:36)
    at Object.<anonymous> (file:///node_modules/.deno/[email protected]/node_modules/gcp-metadata/build/src/index.js:52:20)
    at Object.<anonymous> (file:///node_modules/.deno/[email protected]/node_modules/gcp-metadata/build/src/index.js:409:4)
    at Module._compile (node:module:745:34)
    at loadMaybeCjs (node:module:770:10)
    at Object.Module._extensions..js (node:module:755:12)
    at Module.load (node:module:662:32)
    at Function.Module._load (node:module:534:12)
    at Module.require (node:module:681:19)
    at require (node:module:812:16)

Seems to have something to do with google-logging-utils trying to read process.env.

However, this runs fine locally, the error only happens on Deploy. Version 6.12.0 still works, this error only happens on versions 7.0.0 and above.

Steps to reproduce

Playground with repro: https://dash.deno.com/playground/long-seahorse-77

Expected behavior

Should deploy without errors, like locally or on lower versions.

Environment

Only happens on Deploy.

Possible solution

No response

Additional context

No response

@hongkongkiwi
Copy link

hongkongkiwi commented Feb 2, 2025

Same issue here also using Deno. I have submitted a fix: googleapis/gax-nodejs#1696

@magurotuna
Copy link
Member

The quick patch for this issue is ready to land. We plan to ship it tomorrow.

@hongkongkiwi
Copy link

hongkongkiwi commented Feb 2, 2025

The quick patch for this issue is ready to land. We plan to ship it tomorrow.

This is amazing!! Thank you!!!

I did find a work around and submitted it as above, but since this is an upstream library I pretty much would have to wait for google to accept it which may never happen... and it really seems like a bug since it's not something particularly unusual they are doing. If you can patch it in Deno that would be much better.

@komondor
Copy link

komondor commented Feb 2, 2025

A fix has been submitted denoland/deno#27891

In the meatime, you could upgrade to the canary build deno upgrade canary

@daem-on
Copy link
Author

daem-on commented Feb 2, 2025

@komondor Interestingly, this issue doesn't appear when running locally:

$ deno --version
deno 2.1.9 (stable, release, x86_64-pc-windows-msvc)
v8 13.0.245.12-rusty
typescript 5.6.2

$ deno eval "import 'npm:@google-cloud/storage'"

Runs with no errors, unlike the example in the PR you linked.

@magurotuna
Copy link
Member

The patch landed on production. Now I confirmed that this simple app works fine on Deno Deploy:

import "npm:[email protected]";

Deno.serve(() => {
    return new Response("ok");
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants