{"record":{"id":"e233efe62f0b2d47","repo":"ComposioHQ/composio","slug":"file-operations-upload-download-are-not-supporte","errorCode":null,"errorMessage":"File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (e.g., `node:crypto`, `node:fs`) that are not available in this environment. Please use a Node.js runtime for file operations.","messagePattern":"File operations \\(upload/download\\) are not supported in Cloudflare Workers or Edge runtimes\\. These operations require Node\\.js-specific APIs \\(e\\.g\\., `node:crypto`, `node:fs`\\) that are not available in this environment\\. Please use a Node\\.js runtime for file operations\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/Files.workerd.ts","lineNumber":32,"sourceCode":"\n/**\n * Creates a Proxy that throws a user-friendly error when any method is accessed.\n * This ensures that users get a clear error message when attempting to use\n * file operations in unsupported environments.\n */\nconst createUnsupportedFilesProxy = (): Files => {\n  const handler: ProxyHandler<object> = {\n    get(_target, prop) {\n      // Allow access to constructor name for debugging\n      if (prop === Symbol.toStringTag) {\n        return 'Files';\n      }\n      if (prop === 'constructor') {\n        return Files;\n      }\n      // For any method access, return a function that throws\n      return () => {\n        throw new Error(UNSUPPORTED_MESSAGE);\n      };\n    },\n  };\n\n  return new Proxy({}, handler) as Files;\n};\n\n/**\n * Files class for Cloudflare Workers / Edge runtimes.\n * All methods throw an error indicating that file operations are not supported.\n */\nexport class Files {\n  constructor(_client: ComposioClient) {\n    // Return a Proxy instead of the actual instance\n    return createUnsupportedFilesProxy();\n  }\n}\n","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/Files.workerd.ts#L14-L50","documentation":"In Cloudflare Workers / Edge runtimes, the Files model is a Proxy that throws on any method access because file upload/download needs Node.js-only APIs (node:crypto, node:fs). This is a hard runtime capability error, not a data problem.","triggerScenarios":"Importing and calling any method on composio.files (upload/download) in a build resolved to Files.workerd.ts — i.e. running under Cloudflare Workers or an Edge runtime where the workerd build of the SDK is selected.","commonSituations":"Deploying a Node.js service to Cloudflare Workers without removing file features; bundlers resolving the 'workerd'/edge condition of the package exports; integration tests running in a workerd-compatible environment.","solutions":["Move file upload/download logic to a Node.js runtime (separate service or worker with nodejs_compat plus correct build)","Guard file calls behind a runtime check and skip them in Workers","If Node APIs are genuinely available, ensure your bundler resolves the node build of @composio/core instead of the workerd build"],"exampleFix":"// before\nconst file = await composio.files.uploadFromPath('/tmp/a.pdf');\n// after (route to a Node.js service, or guard)\nif (platform.supportsFileSystem) {\n  await composio.files.uploadFromPath('/tmp/a.pdf');\n}","handlingStrategy":"type-guard","validationCode":"const supportsNodeFiles = typeof process !== 'undefined' && !!process.versions?.node;\nif (!supportsNodeFiles) throw new Error('files API requires Node.js runtime');","typeGuard":"const canUseFiles = (): boolean =>\n  typeof process !== 'undefined' && Boolean(process.versions?.node);","tryCatchPattern":"try { await composio.files.uploadFromPath(p); } catch (e) { if (/not supported in Cloudflare Workers/.test(String(e?.message))) { fallbackToMemoryUpload(); return; } throw e; }","preventionTips":["Feature-detect Node APIs before touching composio.files","Route file features to a Node service in Workers deployments","Verify bundler conditions resolve the correct build per runtime"],"tags":["cloudflare-workers","edge-runtime","files","runtime-unsupported"],"backgroundTag":"unsupported-platform-api","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}