bundlerOptions.ignoreModules

hi, i’m trying to create a worker and pass him ignoreModules list in order to have a custom logger used by a workflow.

i’m getting this error message:
Your Workflow code (or a library used by your Workflow code) is importing the following disallowed modules:
- ‘fs’
- ‘path’
- ‘os’
- ‘crypto’
- ‘util’
- ‘zlib’
- ‘http’
- ‘https’
- ‘string_decoder’
- ‘buffer’
- ‘events’
- ‘string_decoder/’

this is the code that creates the worker:
Worker.create({
workflowsPath: path.resolve(‘src/api/v1/workflows.index.ts’),
activities,
connection,
bundlerOptions: {
ignoreModules: [
@amplitude/analytics-node’,
‘fs’,
‘path’,
‘os’,
‘crypto’,
‘util’,
‘http’,
‘https’,
‘zlib’,
‘string_decoder’,
‘buffer’,
‘events’,
‘string_decoder’,
],
},
namespace: process.env.TEMPORAL_NAMESPACE,
taskQueue: process.env.TEMPORAL_WORKER_TASK_QUEUE || ‘MAIN_WORKER’,
})

still getting the error. am i doing something wrong?
thanks!

i’m trying to create a worker and pass him ignoreModules list in order to have a custom logger used by a workflow.

Your logger library certainly needs to do some i/o operations. That’s not possible from inside the workflow sandbox, as i/o inherently introduces non-deterministic behaviors.

The correct way to do logging from a workflow is to use sinks.