artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.06k stars 512 forks source link

Cannot find module run-fargate.js on a Multiple Scenario specs. #2590

Open saurabhmarwaha opened 8 months ago

saurabhmarwaha commented 8 months ago

Issue: Cannot find module run-fargate.js on a Multiple Scenario specs. Note: If I keep the config and scenario in one file, it works.

Am I giving a wrong execution command? Followed: https://github.com/artilleryio/artillery/tree/main/examples/multiple-scenario-specs

Summary: Trying to execute simple script that hits http endpoint which executes perfectly fine locally, but when I try to scale using AWS Lambda, I am getting an issue 'module not found' (run-fargate.js).However, not sure why it's looking for run-fargate module when ideally it should call run-lambda.js which is also in lib/cmds folder.

Also, notice that it doesn't bundle

Version info:

NPM VERSION: 10.2.4

Artillery: 2.0.8
Node.js:   v20.11.1
OS:        win32

Running this command:

PS C:\Users\<<user>>\Documents\testing> artillery run-lambda --config common-config.yml scenarios/backend-endpoint-matrix.yml --region us-east-1

Error:

[MODULE_NOT_FOUND] ModuleLoadError Plugin: artillery: [MODULE_NOT_FOUND] require failed to load /var/task/node_modules/artillery/lib/cmds/run-fargate.js: Cannot find module 'rc'\n"

Terminal:

Powershell with Set-ExecutionPolicy RemoteSigned Also tried on bash terminal

Execution

Test run id: tqy53_6qhqhn9j4eq5ertgbhezegb5zd57x_hyem NOTE: AWS Lambda support is experimental. Not all Artillery features work yet. For details please see https://docs.art/aws-lambda

λ Creating AWS Lambda function...

Estimated AWS Lambda cost for this test: $0.001 cmds

Files being used:

AppData\Roaming\npm\node_modules\artillery\lib\cmds  - See Screenshot

Folder tree: testing\scenarios\backend-endpoint-matrix
``
# https://github.com/artilleryio/artillery/blob/main/examples/http-metrics-by-endpoint/endpoint-metrics.yml
# https://github.com/artilleryio/artillery/tree/main/examples/multiple-scenario-specs
scenarios:
  - name: backendEndpoint
    flow:
      - get:
          url: "/"
          expect:
            statusCode: 200

``

testing\common-config.yml
config:
  target: https://domain.com
  phases:
    - duration: 20
      arrivalRate: 1
      rampTo: 5
      name: Warm up phase

Package.json attached.

package.json

Node_modules installed. See SS Node_Module

Cloudwatch Logs

2024-03-21T06:23:32.382Z 9b0dee15-735e-41f5-9a72-eefd4a4672ae ERROR (node:24) [MODULE_NOT_FOUND] ModuleLoadError Plugin: artillery: [MODULE_NOT_FOUND] require failed to load /var/task/node_modules/artillery/lib/cmds/run-fargate.js: Cannot find module 'rc' Require stack:

bernardobridge commented 5 months ago

Hello @saurabhmarwaha and anyone else reading here 👋

Since Artillery 2.0.14, we've changed the way Lambda works. You shouldn't run into these issues anymore. Can you please upgrade and see if you still run into any issues? Thank you!