Problem:
Especially when running within a container or pipeline, the Snyk CLI commands may fail in some environments, but succeed in others using the same SNYK_TOKEN or snyk config api settings.
When running the test with -d (debug) command, the error can be seen to be
"Failed to determine default value for "ORGANIZATION":unable to retrieve org
ID (status: 401)"
possibly combined with
CustomError: Authentication failed. Please check the API token on https://snyk.io
Discussion:
An issue was found in CLI versions prior to 1.1191.0 where Authentication was utilising the presence of a TOKEN environment variable
Resolution:
Update your cli version to 1.1191.0
or higher
Ref:SK-22