Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
We've just hit the same problem as #14970 (which is closed) upgrading to the latest packages, but that issue says it's fixed - it doesn't seem to be.
If we log the error being swallowed by this try, catch:
https://github.com/nestjs/nest/blob/master/packages/common/pipes/file/file-type.validator.ts#L93-L95
thrown by the loadEsm call:
https://github.com/nestjs/nest/blob/master/packages/common/pipes/file/file-type.validator.ts#L75-L76
we get:
TypeError: A dynamic import callback was invoked without --experimental-vm-modules
at importModuleDynamicallyCallback (node:internal/modules/esm/utils:226:11)
at loadEsm (/Users/yyy/node_modules/load-esm/index.js:2:26)
at FileTypeValidator.isValid (/Users/yyy/node_modules/@nestjs/common/pipes/file/file-type.validator.js:46:73)
at ParseFilePipe.validateOrThrow (/Users/yyy/node_modules/@nestjs/common/pipes/file/parse-file.pipe.js:58:41)
at ParseFilePipe.validate (/Users/yyy/node_modules/@nestjs/common/pipes/file/parse-file.pipe.js:53:24)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ParseFilePipe.validateFilesOrFile (/Users/yyy/node_modules/@nestjs/common/pipes/file/parse-file.pipe.js:43:13)
at async ParseFilePipe.transform (/Users/yyy/node_modules/@nestjs/common/pipes/file/parse-file.pipe.js:34:13)
at async resolveParamValue (/Users/yyy/node_modules/@nestjs/core/router/router-execution-context.js:148:23)
at async Promise.all (index 1)
at async pipesFn (/Users/yyy/node_modules/@nestjs/core/router/router-execution-context.js:151:13)
at async /Users/yyy/node_modules/@nestjs/core/router/router-execution-context.js:37:30 {
code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG'
}
It seems to be a breaking change - I'm not yet clear if this is limited to just our jest config or would require a change to our production environment too?
Minimum reproduction code
empty
Steps to reproduce
No response
Expected behavior
Tests pass as previously.
Package
- I don't know. Or some 3rd-party package
-
@nestjs/common
-
@nestjs/core
-
@nestjs/microservices
-
@nestjs/platform-express
-
@nestjs/platform-fastify
-
@nestjs/platform-socket.io
-
@nestjs/platform-ws
-
@nestjs/testing
-
@nestjs/websockets
- Other (see below)
Other package
No response
NestJS version
No response
Packages versions
"@nestjs/common": "^11.1.0",
"@nestjs/core": "^11.1.0",
"@nestjs/platform-express": "^11.1.0",
Node.js version
20.16.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response