Could not determine the latest version if CLI

Recently my token was reset, and since, I was unable to start / install apps.

It is not clear to me if this is a token problem or not.

The message I get when running any command is the following:

image

Would you be able to advise on this please.

Thanks

Ahmed

Hi Ahmed,

This error is probably caused by an incorrect token used by the CLI. Did you configure the CLI to use the new token? This can be done with viktor-cli configure

Hi Raoul,

I have configured it with the token I received by email.

Tried deleting the cli and downloading again a new one from the documentation and reconfiguring.
Placed it in a different directory.
Unfortunately all did not work.

Can you try to run the check-system command. Does this indicate any problems? If not can you try the following curl command:

curl -i -X POST https://sys.viktor.ai/verify/ \
   -H 'Content-Type: application/json' \
   -d '{"dev_name": "VIKTOR_DEV" ,"dev_token": "VIKTOR_TOKEN", "subdomain": "SUBDOMAIN"}'

Replace VIKTOR_DEV with the email address, VIKTOR_TOKEN with your token and SUBDOMAIN with the subdomain of your development account. Does this return a 200 status code?

Running the check-system return “X Docker runs”

Do I run the cURL in the cmd or do I run it elsewhere?
Running it in cmd returns is not recognized as an internal or external command

In cmd you can use the following command (please make sure to escape the quotes inside the json body):

curl -i -X POST https://sys.viktor.ai/verify/ -H "Content-Type: application/json" -d "{\"dev_name\": \"VIKTOR_DEV\" ,\"dev_token\": \"VIKTOR_TOKEN\", \"subdomain\": \"SUBDOMAIN\"}"

From the check-system it also seems that your system is not yet correctly configured to start using VIKTOR. You need to make sure that Docker desktop is running before you can use VIKTOR. A full set of installation instructions can be found here: Installation | VIKTOR Documentation.

The check-system command now returns all checks are good. (Just had to launch docker as it was off)

the curl command however is still not working and returns:

https://sys.viktor.ai/verify/ -H “Content-Type: application/json” -d “{“dev_name”: “amo@mhpoly.nl” ,“dev_token”: “amo-token”, “subdomain”: “mhpoly”}”
HTTP/1.1 403 Forbidden
Allow: POST, OPTIONS
Content-Type: application/json
Date: Thu, 16 Dec 2021 08:49:52 GMT
Referrer-Policy: same-origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Length: 63
Connection: keep-alive

{“detail”:“You do not have permission to perform this action.”}

when replacing the token with the path of the token file i get instead:

https://sys.viktor.ai/verify/ -H “Content-Type: application/json” -d “{“dev_name”: “amo@mhpoly.nl” ,“dev_token”: , “subdomain”: “mhpoly”}”
HTTP/1.1 400 Bad Request
Allow: OPTIONS, POST
Content-Type: application/json
Date: Thu, 16 Dec 2021 08:50:35 GMT
Referrer-Policy: same-origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Length: 78
Connection: keep-alive

[{“detail”:“JSON parse error - Invalid \escape: line 1 column 47 (char 46)”}]

The subdomain does not seem to be correct. This should be the subdomain of your development account dev-amo-mhpoly-nl. Does this still result in a 403?

The value of dev_token should be the token itself, not the name of the file and not the path to the file

Thanks for clarifying

The error 403 appears again

https://sys.viktor.ai/verify/ -H “Content-Type: application/json” -d “{“dev_name”: “amo@mhpoly.nl” ,“dev_token”: “amo-token”, “subdomain”: “dev-amo-mhpoly-nl”}”
HTTP/1.1 403 Forbidden
Allow: POST, OPTIONS
Content-Type: application/json
Date: Thu, 16 Dec 2021 09:20:14 GMT
Referrer-Policy: same-origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Length: 63
Connection: keep-alive

{“detail”:“You do not have permission to perform this action.”}

Is “amo-token” the actual value you used in the request? This is not correct, it should be the token that is contained in the file you received. This is also holds for supplying the token with the configure command btw.

I now get the code 200

https://sys.viktor.ai/verify/ -H “Content-Type: application/json” -d “{“dev_name”: “amo@mhpoly.nl” ,“dev_token”: “”, “subdomain”: “dev-amo-mhpoly-nl”}”
HTTP/1.1 200 OK
Allow: OPTIONS, POST
Content-Type: application/json
Date: Thu, 16 Dec 2021 09:22:52 GMT
Referrer-Policy: same-origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Length: 2
Connection: keep-alive

Can you check if the token you configured is the same as the one you supplied in this command. This can be done with viktor-cli check-system list-accounts. Please do not post the output as it contains the token:)

Now it is clear what had gone wrong

In summary, it was a fault with configuring

What I did was to drag and drop the token to the cmd when it asks to supply the token.
Apparently that is not the way.
Instead I have converted it to .txt and copied the token code to cmd and now it works.

Thank you for the support

Ok, happy coding!

1 Like