#6676 Importing @google-cloud/storage fails with nodejs_compat_v2
Valid bug affecting multiple @google-cloud packages. Root cause is workerd's nodejs_compat util.inherits() implementation - related to open workerd#4035. Multiple users confirmed, last updated Oct 2025.
Link to workerd#4035 as they share same root cause; keep open awaiting workerd fix
Analysis Report
Issue Review: cloudflare/workers-sdk#6676
Summary
Importing @google-cloud/storage fails with nodejs_compat_v2 due to TypeError: (init_inherits(...) , __toCommonJS(...)) is not a function in readable-stream dependency.
Findings
- Created: 2024-09-11
- Updated: 2025-10-30
- Version: 3.76.0 → 4.60.0 (current)
- Component: Wrangler / nodejs_compat_v2
- Labels: bug
- Comments: 3 (all confirming similar issues with other @google-cloud packages)
Key Evidence
Multiple reporters confirm the issue - Comments mention the same error with
@google-cloud/recaptcha-enterpriseand@google-cloud/pubsub, indicating this is a broader problem with Google Cloud SDK packages.Related workerd issue exists - workerd#4035 reports a very similar error (
The "superCtor.prototype" property must be of type object) when using packages that depend onreadable-streamandutil.inherits(). That issue is still open with recent activity (September 2025).Root cause appears to be in workerd - The error occurs in the
node:utilinheritsfunction whensuperCtoris undefined. Comments on workerd#4035 from maintainer @anonrig confirm: "It seems node:util inherits method is receiving an undefined value, whereas it should receive an object."No fix found in changelogs or PRs - No merged PRs reference this issue, and the wrangler changelog doesn't mention any fixes for this error.
Workaround exists - Users on workerd#4035 have found success by avoiding packages that use
readable-streamin favor of alternatives (e.g., usingjoseinstead ofjsonwebtoken).Issue is not stale - Last updated October 2025, with related workerd issue active as of September 2025.
Recommendation
Status: KEEP OPEN
Reasoning: This is a legitimate, reproducible bug affecting multiple Google Cloud SDK packages. The root cause appears to be in workerd's nodejs_compat implementation of node:util.inherits(). The related workerd#4035 is still open and being actively investigated. Multiple users have confirmed the issue persists with current versions.
Action:
- Link this issue to workerd#4035 as they share the same root cause
- Add label to indicate this is waiting on upstream workerd fix
- Consider closing as duplicate of or linking to a tracking meta-issue for nodejs_compat compatibility problems
Suggested Comment
This issue appears to share the same root cause as cloudflare/workerd#4035 - the
node:util.inherits()implementation in workerd's nodejs_compat receives an undefinedsuperCtorvalue when certain packages (including @google-cloud/* packages that depend onreadable-stream) are bundled.The workerd team is aware of this class of issues. In the meantime, if you need to use Google Cloud services from Workers, you may need to:
- Use REST API directly instead of the SDK
- Use alternative libraries that don't depend on
readable-streamLinking to workerd#4035 for tracking.
Notes & Feedback (0)
No notes yet.