Nordstrom / artillery-plugin-aws-sigv4

Plugin for artillery.io that signs HTTP requests using the AWS Signature V4 specification.
Apache License 2.0
16 stars 21 forks source link

[Bug Report] It is not possible to load a processor when this plugin is enabled #34

Open RichardSieg opened 2 years ago

RichardSieg commented 2 years ago

I tried loading some custom JS code to load and transform the request body. However, this is not possible when this plugin is activated. I get the following error message

TypeError: Cannot create property 'addAmazonSignatureV4' on string './load-examples.js'

My config (the relevant part)

config:
  target: something.com
  plugins:
    aws-sigv4:
      serviceName: execute-api
    expect: {}
  processor: "./load-examples.js"

I guess this is due to the following line of code:

https://github.com/Nordstrom/artillery-plugin-aws-sigv4/blob/cd0e66c2c57f157da8effff76f24baaf999a8bdb/lib/aws-sigv4.js#L147

RichardSieg commented 2 years ago

I guess I have fixed it. In the beginning of the init function we have to check the following:

if (typeof process.env.LOCAL_WORKER_ID === 'undefined') {
    debug('Not running in a worker, exiting');
    return;
  }

I created an own fork where I also restructured the plugin to fit the documentation on how to write plugins. See https://github.com/RichardSieg/artillery-plugin-aws-sigv4/tree/feature/fix-custom-processor

RJKeane2000 commented 2 years ago

@RichardSieg I ran into this same issue and tried out your version. It worked great! I'm looking forward to it being merged and a new build. Thanks for your efforts!