-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Description
The Workflow DevKit bundler fails to bundle workflow files that import packages using
Node.js built-in modules (e.g., stream, http, https, zlib, crypto). This
breaks most database clients, HTTP libraries, and cloud SDKs.
Environment
- workflow:
4.0.1-beta.4 - @workflow/next:
4.0.1-beta.4 - Next.js:
16.0.0 - Node.js:
v23.x(or your version) - Platform: macOS/Linux/Windows
Error Output
✘ [ERROR] Could not resolve "stream"
node_modules/@supabase/node-fetch/lib/index.js:8:37:
8 │ var Stream = _interopDefault(require('stream'));
╵ ~~~~~~~~
The package "stream" wasn't found on the file system but is built into node.
Are you trying to bundle for node? You can use "platform: 'node'" to do that,
which will remove this error.
✘ [ERROR] Could not resolve "http"
✘ [ERROR] Could not resolve "https"
✘ [ERROR] Could not resolve "zlib"
✘ [ERROR] Could not resolve "punycode"
Error: Build failed with 7 errors
Reproduction Steps
- Install Workflow DevKit and Supabase client:
npm install workflow@4.0.1-beta.4 @supabase/supabase-js- Create a workflow file using Supabase:
// lib/workflows/example.ts
import { createClient } from '@supabase/supabase-js'
async function checkDatabase(userId: string) {
"use step"
const supabase = createClient(
process.env.SUPABASE_URL!,
process.env.SUPABASE_KEY!
)
const { data } = await supabase
.from('users')
.select('*')
.eq('id', userId)
.single()
return data
}
export async function exampleWorkflow(args: { userId: string }) {
"use workflow"
const user = await checkDatabase(args.userId)
return { user }
}
- Run
npm run dev - Bundler fails with "Could not resolve" errors for Node.js built-ins
Root Cause
The workflow bundler appears to use platform: 'browser' configuration (or equivalent),
treating Node.js built-in modules as external dependencies that don't exist. However,
workflow steps actually execute in a Node.js environment on Vercel's servers.
Affected Packages
This issue breaks any package that uses Node.js built-ins:
Database Clients:
- ❌ @supabase/supabase-js
HTTP Clients:
- ❌ node-fetch
What Works:
- ✅ Native fetch() (Web API)
- ✅ Pure JavaScript libraries with no Node.js dependencies
Current Workaround
Replace client library calls with manual fetch() requests:
// Instead of:
const { data } = await supabase.from('table').select('*')
// Use REST API directly:
const res = await fetch(`${SUPABASE_URL}/rest/v1/table`, {
headers: {
'Authorization': `Bearer ${SUPABASE_KEY}`,
'apikey': SUPABASE_KEY
}
})
const data = await res.json()
This works but loses type safety, autocomplete, and requires manual query construction.
Copilot and tuliren
Metadata
Metadata
Assignees
Labels
No labels