[BUG] malformed env JSON gives "Error: Invalid env" message with no context

Open
#45 0 comments 0 reactions 1 assignee View on GitHub

@kusweta is already working on this.

Since Feb 28, 2023.

Assessment

This issue has not been assessed yet.

Description

need-to-triage

I ran the GitHub action with the following input

- name: 'Azure Load Testing'
        uses: azure/load-testing
        with:
          loadTestConfigFile: 'loadtest/smoketest.yaml'
          loadTestResource: ${{ env.AZURE_LOAD_TEST_NAME }}
          resourceGroup: ${{ env.AZURE_RESOURCE_GROUP_NAME }}
          env: |
            [
              {
              "name": "domain",
              "value": ${{ env.AZURE_LOAD_TEST_HOST }}
              }
            ]

This returned Error: Invalid env.

env could refer to :

  1. The environment variables
  2. The workflow environment variables
  3. The action environment variables
  4. The env parameter

The actual issue was that the JSON in env parameter was invalid because it was missing quotes, but it was difficult to diagnose. Please can you update the error message here to be more specific
https://github.com/Azure/load-testing/blob/main/src/mappers.ts#L388-L390

The exception object has a detailed message on why JSON.parse failed but this context is being lost

Dominant language
TypeScript
Stars
20
Forks
27
Avg merge
6d 16h
Merged PRs (30d)
8

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/load-testing

All issues in Azure/load-testing

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.