postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.88k stars 1.17k forks source link

Error: could not load environment #3131

Open damienrobson-sage opened 1 year ago

damienrobson-sage commented 1 year ago
  1. Newman Version (can be found via newman -v): 5.3.2
  2. OS details (type, version, and architecture): Ubuntu 22.04 x64 (GitHub Actions pipeline)
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there: Recently
  5. Expected behaviour: Newman runs with the correct environment.
  6. Command / script used to run Newman: newman run collection.js --environment config.json

When running locally (MacOS 13.4.1) the above command works fine. When I try and run it within a GitHub actions pipeline, the following error is shown:

error: could not load environment
  Trailing comma in array at 20:7
      ],
      ^

I've checked all of the files on our end but I can't track down the error anywhere, therefore I'm assuming the error is somewhere internal to newman.

jcopperman commented 1 year ago

Would love to hear if you got any feedback on this @damienrobson-sage. I have the same issue only intermittently when running in a Github workflow with Postman CLI. And again, since it's intermittent and there are no logs I can't reproduce it :(

Run echo "result=1" >> $GITHUB_OUTPUT
Error: could not load environment
  Unexpected token '<' at 1:1
<html>
^
Alan-Wales commented 1 year ago

We've encountered this for quite some months using the postman cli. It's transitory and no other information to help debug it even in verbose mode (perhaps a trace id or similar would be useful)

damienrobson-sage commented 1 year ago

@jcopperman unfortunately, no. It eventually went away of it's own volition and hasn't been seen since. Quite frustrating that there's been zero acknowledgement from the devs on this, too. I would close the issue but I think enough people keep coming a cropper with it that it should remain open and make as much noise as possible until it gets noticed

CarlosPintoF commented 1 year ago

Facing the same issue issue only intermittently when running in a Github workflow

AnthonySteele-NewDay commented 9 months ago

Same. Once or twice a day, on various different test runs in GitHub actions, we see:

$ newman run https://api.getpostman.com/collections/***?apikey=***  --otheroptions

error: could not load environment
Unexpected token '<' at 1:1
<html>
 ^

What this looks like is that the api.getpostman.com/collections endpoint has intermittent issues, there is no retry in the code that gets from it, and the end result is that our tests are flakey.

However we don't see more details of the response - the status code and response body would help.