artillery
artillery copied to clipboard
Running on Lambda fails with ArtilleryError: Error: Cannot find module '@oclif/core'
Version info:
Artillery: 2.0.0-36
Node.js: v18.16.0
OS: darwin
Running this command:
artillery run-lambda --region us-east-1 example.yml
I expected to see this happen:
The test runs
Instead, this happened:
λ Creating AWS Lambda function...
- Bundling test data
- example.yml
- package.json
- package-lock.json
- Installing dependencies
- Creating zip package
Preparing AWS environment...
- Lambda function: artilleryio-<ID>
- Region: us-east-1
- AWS account: <ACCOUNT_ID>
A Lambda function has exited with an error. Reason: ArtilleryError
{
stdout: '',
stderr: 'node:internal/modules/cjs/loader:1031\n' +
' throw err;\n' +
' ^\n' +
'\n' +
"Error: Cannot find module '@oclif/core'\n" +
'Require stack:\n' +
'- /var/task/node_modules/artillery/bin/run\n' +
' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)\n' +
' at Function.Module._load (node:internal/modules/cjs/loader:873:27)\n' +
' at Module.require (node:internal/modules/cjs/loader:1100:19)\n' +
' at require (node:internal/modules/cjs/helpers:108:18)\n' +
' at Object.<anonymous> (/var/task/node_modules/artillery/bin/run:8:16)\n' +
' at Module._compile (node:internal/modules/cjs/loader:1198:14)\n' +
' at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)\n' +
' at Module.load (node:internal/modules/cjs/loader:1076:32)\n' +
' at Function.Module._load (node:internal/modules/cjs/loader:911:12)\n' +
' at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {\n' +
" code: 'MODULE_NOT_FOUND',\n" +
" requireStack: [ '/var/task/node_modules/artillery/bin/run' ]\n" +
'}\n'
}
--------------------------------
Summary report @ 16:57:00(+0100)
--------------------------------
No measurements recorded during this period
Files being used:
config:
target: https://api.mysite.com
phases:
- duration: 60
arrivalRate: 1
rampTo: 100
name: Warm up phase
- duration: 60
arrivalRate: 5
rampTo: 500
name: Ramp up load
- duration: 30
arrivalRate: 50
rampTo: 5000
name: Spike phase
scenarios:
- flow:
- loop:
- post:
url: "/my-endpoint"
headers:
Api-Key: "<MY_API_KEY>"
Content-Type: "application/json"
json:
key: "value"
count: 1
Hey @jakekgrog !
I tried replicating this on Artillery v2.0.0-36 and didn't have an issue.
I did notice it's bundling a package.json
and package-lock.json
. Can I ask you what are the contents of the package.json
? Does it have Artillery or oclif installed as dependencies by any chance?
Hi @bernardobridge!
I've removed those files and I'm getting the same issue:
λ Creating AWS Lambda function...
- Bundling test data
- example.yml
- Installing dependencies
- Creating zip package
Preparing AWS environment...
- Lambda function: artilleryio-<ID>
- Region: us-east-1
- AWS account: <ACCOUNT_ID>
A Lambda function has exited with an error. Reason: ArtilleryError
{
stdout: '',
stderr: 'node:internal/modules/cjs/loader:1031\n' +
' throw err;\n' +
' ^\n' +
'\n' +
"Error: Cannot find module '@oclif/core'\n" +
'Require stack:\n' +
'- /var/task/node_modules/artillery/bin/run\n' +
' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)\n' +
' at Function.Module._load (node:internal/modules/cjs/loader:873:27)\n' +
' at Module.require (node:internal/modules/cjs/loader:1100:19)\n' +
' at require (node:internal/modules/cjs/helpers:108:18)\n' +
' at Object.<anonymous> (/var/task/node_modules/artillery/bin/run:8:16)\n' +
' at Module._compile (node:internal/modules/cjs/loader:1198:14)\n' +
' at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)\n' +
' at Module.load (node:internal/modules/cjs/loader:1076:32)\n' +
' at Function.Module._load (node:internal/modules/cjs/loader:911:12)\n' +
' at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {\n' +
" code: 'MODULE_NOT_FOUND',\n" +
" requireStack: [ '/var/task/node_modules/artillery/bin/run' ]\n" +
'}\n'
}
--------------------------------
Summary report @ 12:32:20(+0100)
--------------------------------
No measurements recorded during this period
Hmm.. weird 🤔 . As I mentioned, I have tried with v2.0.0-36
and don't can't reproduce the issue.
Can you share more about your file structure, and how you're installing Artillery?
Also, would you mind double checking the Artillery version with --version
?
Thank you.
I installed artillery using npm install -g artillery@latest
This is my version info:
Artillery: 2.0.0-36
Node.js: v18.16.0
OS: darwin
This is my file structure, its just a single yml file:
/load-test
|
|--> example.yml
Just as a note, I was able to get this to run on fargate.
hey @jakekgrog 👋 Unable to reproduce here either. Are you using an npm caching proxy or a private registry of any kind (e.g. Verdaccio, Artifactory, Cloudsmith etc)
I am also getting the same error. OS: macOS ventura
A Lambda function has exited with an error. Reason: ArtilleryError
{
stdout: '',
stderr: 'node:internal/modules/cjs/loader:1031\n' +
' throw err;\n' +
' ^\n' +
'\n' +
"Error: Cannot find module '@oclif/core'\n" +
'Require stack:\n' +
'- /var/task/node_modules/artillery/bin/run\n' +
' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)\n' +
' at Function.Module._load (node:internal/modules/cjs/loader:873:27)\n' +
' at Module.require (node:internal/modules/cjs/loader:1100:19)\n' +
' at require (node:internal/modules/cjs/helpers:108:18)\n' +
' at Object.
Hello having the same issue here too @jakekgrog did you find a solution?