Open hmeng1024 opened 6 months ago
hmmmm...maybe i didn't describe the issue clearly - I know 401 Unauthorized looks just like i miss authorization stuff.
To make the issue more specific - Difference observed (with same simple request) between Bruno Client run and bru cli run. Wondering if there is certain a debug way we can observe verbose execution details from bru run?
Anybody pls could advise?
@hmeng1024 It's a bit hard to narrow down without seeing the exact Bru file.
How does the authorization on the Endpoint work? Could you instead make a request to something like: https://httpbin.org/anything
and see any differences in the responses? You can also log the req
and res
using console.log
inside your script.
CLI and Electron/Client have different implementations for making requests, that often causes issues.
@Its-treason Thank you for your reply and advice. It helped!
The req
with pre-request scripts helped me to locate the issue and there DOES
have a bug in bru cli when processing Secret
value from VARs.
Basically what happened is one of my password VAR used in the PUT body cannot be resolved when it's a Secret
field.
Quick replication as below and that should be fair enough for a bug fix request :0
❯ bru run httpbin --env Local
(node:57459) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Running Folder
baseUrl: http://httpbin.org
httpbin/httpbin - get (200 OK) - 498 ms
Requests: 1 passed, 1 total
Tests: 0 passed, 0 total
Assertions: 0 passed, 0 total
Ran all requests - 498 ms
❯
❯ bru run httpbin --env Local
(node:57467) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Running Folder
baseUrl: null
httpbin/httpbin - get (getaddrinfo ENOTFOUND null)
Requests: 0 passed, 1 failed, 1 total
Tests: 0 passed, 0 total
Assertions: 0 passed, 0 total
Yeah, that is a known Problem with secret variables: https://github.com/usebruno/bruno/issues/2015
ok, i read through the #2015 and looks we regard it as an expected behaviour with no fix/impr plan yet. While then as the author said there in #2015, it would be great if we can update relevant Bruno Doc to explicitly state this. :) But in general, all good then..thanks.
I have checked the following:
Describe the bug
Issue Bru cli - bru run always gets a
401 Unauthorized
error and that blocks every test frombru cli
, while at the same time same request can be executed successfully frombru client
. (see pic-1 and pic-2 attached)Context
bru run
was doing good at the starting 2-3 days after i installed it about 10 days ago. Back at that time i canbru run folder
successfully with more than 10 req inside. (it was likely at client v1.12.x, bru ver not sure now)What have been tried
client
andcli
to latest v1.14.0folder
tosingle request
, fromtoken-required
scenario totoken-generation
scenarioWith above attempts, the issue is still there and shows exactly same error. The attached pics (pic-1 and pic-2) show a
temp request
intemp folder
doing a token api test. It can still run withClient runner
successfully, butbru cli
fails the same.Bru run traceback The traceback shows
AssertionError
as 200 is expected in the Test. While if the test script is commented out, we can still see the401 Unauthorized
error (see pic-2).I'm not sure if i'm the only person experiencing this issue so far. It appears either 1) it's a
local env
config issue from my own or 2) likely a bug from bru cli run workflow. Can anyone pls shed some light here?.bru file to reproduce the bug
No response
Screenshots/Live demo link
pic-1
pic-2