Azure / Azure/load-testing

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

Aperta
#45 0 commenti 0 reazioni 1 assegnatario Rivendicata da @kusweta Vedi su GitHub
need-to-triage
Lingua principale
TypeScript
Stelle
20
Fork
27
Merge medio
1g 19h
PR unite (30g)
2

Descrizione

I ran the GitHub action with the following input

```yaml
- 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.