bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Bruno CLI doesn't seem to be injecting properly

Open jfslin opened this issue 5 months ago • 3 comments

I have checked the following:

  • [X] I use the newest version of bruno.
  • [X] I've searched existing issues and found nothing related to my issue.

Describe the bug

I've taken a look around and it seems like most of the problems other people had with CLI revolves around injecting secrets, so I think I'm just doing something wrong. Given the following bru file, I am able to set the environment (named 'dev'), which sets sb_name and sb_anonkey (both env vars and not secrets) and run it as expected in the Bruno GUI. My ultimate goal is to use Bruno for CI in Github Actions, hence the CLI interest.

However, the following CLIs (Windows 11, Powershell as well as Command Prompt) doesn't seem to work, giving me a "invalid URL" error, suggesting that sb_name isn't being set properly:

bru.cmd run '.\testing\Patient-Access-Records\Auth.bru' --env dev bru.cmd run '.\testing\Patient-Access-Records\Auth.bru' --env-var sb_name=xxxxx --env-var host=yyyy

Also, is there a way to get the CLI to produce the outbound GET/POST message in the CLI so I can check what it's actually sending (ie the Timeline tab in the Bruno GUI) as oppose to just the runner result?

.bru file to reproduce the bug

meta {
  name: Auth
  type: http
  seq: 1
}

post {
  url: https://{{sb_name}}.supabase.co/auth/v1/token?grant_type=password
  body: json
  auth: none
}

params:query {
  grant_type: password
}

headers {
  apikey: {{sb_anonkey}}
}

body:json {
  {
    "email": "[email protected]",
    "password": "password"
  }
}

vars:post-response {
  jwt_user: res.body.access_token
}

tests {
  test("client can get JWT from supabase", function() {
    const data = res.getBody();
    expect(res.getStatus()).to.equal(200);
  });
}

Screenshots/Live demo link

Working in the GUI:

image

But not in the CLI:

C:\bruno> bru.cmd run '.\testing\Patient-Access-Records\Auth.bru' --env dev
Running Request

.\testing\Patient-Access-Records\Auth (Invalid URL)

Requests:    0 passed, 1 failed, 1 total
Tests:       0 passed, 0 total
Assertions:  0 passed, 0 total
Ran all requests - 0 ms

Requests:    0 passed, 1 failed, 1 total
Tests:       0 passed, 0 total
Assertions:  0 passed, 0 total

jfslin avatar Sep 18 '24 15:09 jfslin