Open raShMan777 opened 3 months ago
Thanks for reporting the bug,
let response = await tc.runRequest("21594a53-568b-466f-82bc-58f1c6abc9c3");
Please log the env values you passed in CLI argument before runRequest and verify it.
I put it in all three requests (values masked by me):
Script Log: access_key inside delete class: XRB5**********************WTCS
Script Log: access_secret_key inside delete class: ym4i******************************************6F97
Script Log: access_key inside read classes:
Script Log: access_secret_key inside read classes:
Script Log: access_key inside logon:
Script Log: access_secret_key inside logon:
Script Log: 'read classes' Response Status': 401
The values were correct but they don't get passed along…
try log the response from this request and verify it. let response = await tc.runRequest("21594a53-568b-466f-82bc-58f1c6abc9c3");
also, see logs you may find other useful info https://docs.thunderclient.com/features/logs
Not sure if what I'm seeing is helpful or not:
Response
Error in Pre Request Script: - Unexpected token 'A', "Authentica"... is not valid JSON
Logs from Scripts
Script Log: access_key inside delete class: XRB5**********************WTCS
Script Log: access_secret_key inside delete class: ym4i******************************************6F97
Script Log: access_key inside read classes:
Script Log: access_secret_key inside read classes:
Script Log: access_key inside logon:
Script Log: access_secret_key inside logon:
Script Log: status: 401
Script Log: time: 37
Script Log: size: 24
Script Log: contentType: application/json
Script Log: json: undefined
Script Log: text: Authentication Failed!!!
Script Log: header name: date, Value: Fri, 09 Aug 2024 11:29:15 GMT
Script Log: header name: content-type, Value: application/json
Script Log: header name: transfer-encoding, Value: chunked
Script Log: header name: connection, Value: keep-alive
Script Log: header name: referrer-policy, Value: same-origin
Script Log: header name: x-frame-options, Value: SAMEORIGIN
Script Log: header name: strict-transport-security, Value: max-age=15724800; includeSubDomains
Script Log: header name: x-content-type-options, Value: nosniff
Script Log: header name: permissions-policy, Value: idle-detection=self
Script Log: header name: content-encoding, Value: gzip
Script Log: header name: x-xss-protection, Value: 1; mode=block
Also I don't see the run/response in VSCode at all and I also don't see any logs there.
For me the question's still the same: why is it working when the values are saved in the environment and not when the values are passed via CLI?
you got any news on the bug?
@raShMan777 We will investigate the issue and get back to you in 1 or 2 days.
I verified it is working for me. Do you still have this problem?
yes, issue still existing with tc cli 1.18.0. just tested it.
Thanks for the confirmation, I will investigate further and get back to you
I have this login request 'Logon': POST:
{{url}}/ims/api/v1/access_keys/login
Headers:Accept */*
JSON Body:Test:
json.json_web_token
setTo{{json_web_token}}
It is set as a Pre Request to run always in this request 'read classes': GET:
{{url}}/events-service/api/v1.0/events/classes
Headers:Accept */*
Auth Bearer:{{json_web_token}}
Test:json.statusCode
equal200
Pre Run:Logon
(Run Always)And it is also set as a Pre Request to run always in this request 'delete class - srz_heartbeatTest': DELETE:
{{url}}/events-service/api/v1.0/events/classes/{{class_id}}
Headers:Accept */*
Auth Bearer:{{json_web_token}}
Test:json.statusCode
equal200
Pre Run:Logon
(Run Always) Pre Run Script:Now, when I'm executing it in VSCode everything's running fine. But when I'm executing it in the CLI I'm emptying the variables access_key, access_secret_key, json_web_token before executing this:
~/node_modules/.bin/tc --env 'Helix-Dev' --reqlist 'delete class - srz_heartbeatTest' --log 0 --var-data "access_key=foo,access_secret_key=bar"
This works when I'm executing e.g. 'read classes' directly and all other request which have
Logon
as Pre Run. When I'm executing 'delete class - srz_heartbeatTest' I get this:It works when the variables are saved in the environment 'Helix-Dev' and not provided via
--var-data
:$ ~/node_modules/.bin/tc --debug
:Platform:
The CLI is executed in my WSL Fedora 40 with:
Using the paid version.