question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

processEnvironment variable not populated when running remotely

See original GitHub issue

$processEnvironment variables are not getting populated when running remotely (using Artillery Pro)

Version info:

Artillery Core: 2.0.0-16
Artillery Pro:  3.0.0-9

YAML

before:
  flow:
      - log: "Getting Token"
      - post:
          url: "/v1/token"
          name: get accessToken
          json:
            clientId: "{{ $processEnvironment.CLIENT_ID}}"
            clientSecret: "{{ $processEnvironment.CLIENT_SECRET }}"
          capture:
            - json: "$.accessToken"
              as: accessToken
          strict: false
          expect:
            - statusCode: 201
            - contentType: application/json
            - hasProperty: accessToken

The following works when running locally with Artillery:

export CLIENT_ID=ABC
export CLIENT_SECRET=XYZ
artillery run /path/to/my/script.yml

But when executing tests remotely with Artillery Pro, the processEnvironment variables don’t seem to be getting set. The following results in “No measurements recorded during this period”

export CLIENT_ID=ABC
export CLIENT_SECRET=XYZ
artillery run-test --region us-east-1 --cluster artilleryio-cluster --count 1 --launch-type ecs:fargate --security-group-ids=XXXXXXX --subnet-ids=subnet-XXXXXX /path/to/my/script.yml

The documentation for Artillery Pro only mentions $processEnvironment in the context of secrets, so I also tried the following, but got the same result:

artillery set-secret --name CLIENT_ID --value ABC --region us-east-1
artillery set-secret --name CLIENT_SECRET --value XYZ --region us-east-1
artillery run-test --secret CLIENT_ID --secret CLIENT_SECRET --region us-east-1 --cluster artilleryio-cluster --count 1 --launch-type ecs:fargate --security-group-ids=XXXXXXX --subnet-ids=subnet-XXXXXX /path/to/my/script.yml

If I hard code the clientId and clientSecret values in the YAML rather than using $processEnvironment variables the remote execution succeeds - so there is definitely an issue with the $processEnvironment variables getting set in the remote environment.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
hassycommented, Jun 10, 2022

@danobri yes indeed, --dotenv will be supported in the local test runner too (just merged #1478)

I have confirmed that I can now pass 2 secrets to run-test, however I find that it does not work if they are the last params before the file path to the test.

we’ll look into that, thank you

As for using DEBUG=http* remotely - I have not looked in Cloudwatch - where would I look? It would be great if you explain this in your documentation - when using artillery pro, which DEBUG variables log locally (like commands:run-test:v), and which log remotely (like http*)?

great suggestion, we’ll update the docs with more information on Cloudwatch logs created by Artillery Pro tests

0reactions
danobricommented, Jul 5, 2022

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set environment variables to RemoteApp? - TechNet
When I launched RemoteApp using RDP file it is not picking the environment variables required. Also this RemoteApp is a third party application ......
Read more >
.net - How to get other process's environment variable using c#
I can get the process environment variables like the following: Process process = Process.GetProcessesByName("someprocess").First(); string ...
Read more >
Win32_Environment - powershell.one
The WMI class Win32_Environment manages user and system environment variables but does not care about process environment variables (the ...
Read more >
linux - Can I change local environment variables for a running ...
I've tried suspending the process ( ctrl - z ), exporting a new value for the variable, then resuming ( fg ), but...
Read more >
Dynamically Add/Edit Environment Variables of Remote Process
In the DLL main, open the share memory and read the required data and finally set the variable; Return from DLL; Now the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found