vmware-labs / marketplace-cli

A CLI for interacting with the VMware Marketplace
Other
11 stars 2 forks source link

CSP Token exchange still can fail #122

Open petewall opened 2 years ago

petewall commented 2 years ago

Even after the code to retry the token request, I'm still seeing intermittent issues with token exchange errors:

$ MARKETPLACE_ENV=staging mkpcli attach vm -p gp-releng-test-1 -v 6.99.99 --create-version --file gpdb6-photon3-ova/greenplum-virtual-machine-v2.0.0-greenplum-6.99.99-photon3.ova --pca-file gpdb6-ova-pca/gpdb-pca-1.0.0.pdf Error: failed to exchange api token: failed to exchange refresh token for access token: 400

Error: failed to initialize token services: failed to parse CSP Public key: invalid character '<' looking for beginning of value

Error: failed to exchange api token: failed twice to exchange refresh token for access token: 503 Service Unavailable

petewall commented 2 years ago

A few possible fixes:

  1. Implement retry logic for all errors, not just 503
  2. Implement retry logic for the whole key exchange
  3. Allow for the auth token to be supplied and if so, shortcut the whole token exchange piece. This has the advantage of speeding up multiple calls in sequence