ComposioHQ/composio · error · Error
File operations (upload/download) are not supported in Cloud
Error message
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.
What it means
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.
Source
Thrown at ts/packages/core/src/models/Files.workerd.ts:32
/**
* Creates a Proxy that throws a user-friendly error when any method is accessed.
* This ensures that users get a clear error message when attempting to use
* file operations in unsupported environments.
*/
const createUnsupportedFilesProxy = (): Files => {
const handler: ProxyHandler<object> = {
get(_target, prop) {
// Allow access to constructor name for debugging
if (prop === Symbol.toStringTag) {
return 'Files';
}
if (prop === 'constructor') {
return Files;
}
// For any method access, return a function that throws
return () => {
throw new Error(UNSUPPORTED_MESSAGE);
};
},
};
return new Proxy({}, handler) as Files;
};
/**
* Files class for Cloudflare Workers / Edge runtimes.
* All methods throw an error indicating that file operations are not supported.
*/
export class Files {
constructor(_client: ComposioClient) {
// Return a Proxy instead of the actual instance
return createUnsupportedFilesProxy();
}
}
View on GitHub (pinned to 64b1b85502)
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
Example fix
// before
const file = await composio.files.uploadFromPath('/tmp/a.pdf');
// after (route to a Node.js service, or guard)
if (platform.supportsFileSystem) {
await composio.files.uploadFromPath('/tmp/a.pdf');
} Defensive patterns
Strategy: type-guard
Validate before calling
const supportsNodeFiles = typeof process !== 'undefined' && !!process.versions?.node;
if (!supportsNodeFiles) throw new Error('files API requires Node.js runtime'); Type guard
const canUseFiles = (): boolean => typeof process !== 'undefined' && Boolean(process.versions?.node);
Try / catch
try { await composio.files.uploadFromPath(p); } catch (e) { if (/not supported in Cloudflare Workers/.test(String(e?.message))) { fallbackToMemoryUpload(); return; } throw e; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- File system operations are not supported in this runtime (e.
- File system operations are not supported in this runtime env
- URL file uploads are not supported in edge runtimes because
- Failed to fetch file from URL: {e.cause}
- URL returned redirect. Please provide a direct URL to the fi
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/e233efe62f0b2d47.
Report an issue: GitHub.