Mastra Cloud analyze failures with ESM/CJS interop (fetch-blob, formdata-polyfill, Pinecone v6)

Summary Our project deployed successfully on 2025-10-13. Since then, Mastra Cloud deployments fail during “Analyze dependencies” due to ESM/CJS interop in transitive dependencies (not our app code). Local mastra build succeeds; only Cloud analyze fails. Environment - Mastra Cloud dynamic deployer banner: “fix-cloud-peer-deps-loggers for core version 0.18.0” - Node: 20.x (engine >= 20.9.0) - pnpm on Cloud: 10.18.1 - App stack: Mastra (Agent + Memory), Postgres, Pinecone, BigQuery, OpenAI, Langfuse exporter Last known good deploy (works) - Date: 2025-10-13 - Logs show build and bundle succeeded; runtime connectivity checks all passed. Current failures (since 2025-10-20) - Primary error seen most often: - “Failed to analyze Mastra application: node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/streams.cjs (4:7): "default" is not exported by "node:process?commonjs-external", imported by "node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/streams.cjs".” - Also previously hit (before we pinned some deps): - Pinecone v6 assistant/data/chatStream.js: default import from node:stream → analyze failure - fetch-blob@4.0.0 + formdata-polyfill@4.0.10: default export mismatch from fetch-blob/file.js → analyze failure Reproduction context - We don’t import fetch-blob directly. It enters via: - node-fetch@3 (via @google-cloud/bigquery ≥ 8) → fetch-blob 3.x → streams.cjs path - Local command passes: - pnpm build → “Build successful, you can now deploy…” - Cloud fails in the “Analyze dependencies” phase with the messages above. Workarounds attempted 1) Pinecone downgrade (works locally) - Pin to avoid assistant/chatStream path: - @pinecone-database/pinecone: 2.2.2 - PR: pinned and verified local build success. 2) Override common web libs (works locally, Cloud still fails) - Tried multiple sets: - fetch-blob: 3.2.0 - formdata-polyfill: 4.0.10 - undici: 5.28.4 - node-fetch: 3.3.2 - Local mastra build succeeds; Cloud analyze still targets fetch-blob/streams.cjs and fails with the node:process default import error. 3) BigQuery client pin (works locally) - Pin @google-cloud/bigquery to 7.8.0 (pre node-fetch@3) to avoid fetch-blob entirely. - Local mastra build succeeds. - Cloud: still intermittently reports fetch-blob@3.2.0 streams.cjs error even after this pin, suggesting the analyzer is still resolving that path in its graph. Current repository references - Pinecone downgrade PR (2.2.2): #34 - fetch-blob/undici overrides PR: #35 - Final override set PR (fetch-blob 3.2.0, formdata-polyfill 4.0.10, undici 5.28.4, node-fetch 3.3.2, Pinecone 2.2.2): #36 - BigQuery pin to 7.8.0 PR: #37 Request - Update Cloud bundler/analyzer configuration to handle: - Default import interop for node:process and node:stream in CJS/Esm hybrids - Common web libs (fetch-blob/formdata-polyfill) default export expectations - Alternatively, publish a compatibility matrix or an official overrides snippet (versions known to work with the current analyzer). Notes - We prefer not to change application code paths (no lazy/dynamic imports). We only pinned dependency versions and kept logic intact. - Happy to provide a minimal reproduction if needed. - This started after 2025-10-13; logs still show core 0.18.0 dynamic deployer, so likely analyzer/plugins tightened or resolution changed. If you need more logs or our exact package.json/pnpm-lock.yaml, we can attach them.
1 Reply
_roamin_
_roamin_16h ago
Hey @montel9705 ! Would love if you could share a small repro example 🙏 Is it a monorepo? Also, could you share your project slug and the deployment id that's failing? Thanks

Did you find this page helpful?