usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
21.85k stars 1.03k forks source link

Got Error invoking remote method 'send-http-request': SyntaxError: Unexpected token ':' #2079

Open ShinoharaHaruna opened 2 months ago

ShinoharaHaruna commented 2 months ago

I have checked the following:

Describe the bug

As shown in the screenshot, when I tried to send a request to test a login rest API, the response in Bruno is an error. However, the request was actually successfully sent and a JWT token string should be in response.

The request has nothing but a JSON body.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

dwiyatci commented 2 months ago

Got similar error in v1.13.0:

Error invoking remote method 'send-http-request': ReferenceError: setEnvVar is not defined

I tried to downgrade to v1.12.3, it didn't occur there.

ShinoharaHaruna commented 2 months ago

Got similar error in v1.13.0:

Error invoking remote method 'send-http-request': ReferenceError: setEnvVar is not defined

I tried to downgrade to v1.12.3, it didn't occur there.

Looks like it's still going to happen on v1.12.3

Besides, I've tried AppImage version and Deb version, and the issue is the same.

pavan-world commented 2 months ago

Got similar error in v1.13.0:

Error invoking remote method 'send-http-request': ReferenceError: setEnvVar is not defined

I tried to downgrade to v1.12.3, it didn't occur there.

https://github.com/usebruno/bruno/issues/2103

Are you seeing something like this?

ClementValot commented 2 months ago

Got similar error in v1.13.0:

Error invoking remote method 'send-http-request': ReferenceError: setEnvVar is not defined

I tried to downgrade to v1.12.3, it didn't occur there.

Got a similar regression upgrading from 1.12.3 to 1.13.1, firing some requests displays ReferenceError and triggers a dozen AbortionError in the console image

I'll run a few tests to try and pinpoint which part of the request triggers these errors

EDIT: For me it's bru.getEnvName() in the pre-request script that's throwing an uncaught exception, dug into the diff between 1.12 and 1.13 to no avail :(

EDIT 2: Accessing bru.envVariables.__name__ does not throw but calling bru.getEnvName() does 🙃 I'm stuck

EDIT 3: Here's the stack in case it helps

  | asyncGeneratorStep | @ | _app-78f10fc63fb9eb7c.js:39
-- | -- | -- | --
  | _throw | @ | _app-78f10fc63fb9eb7c.js:39
  | Promise.then (async) |   |  
  | asyncGeneratorStep | @ | _app-78f10fc63fb9eb7c.js:39
  | _next | @ | _app-78f10fc63fb9eb7c.js:39
  | (anonymous) | @ | _app-78f10fc63fb9eb7c.js:39
  | (anonymous) | @ | _app-78f10fc63fb9eb7c.js:39
  | (anonymous) | @ | _app-78f10fc63fb9eb7c.js:22
  | (anonymous) | @ | _app-78f10fc63fb9eb7c.js:1
  | (anonymous) | @ | _app-78f10fc63fb9eb7c.js:19
  | subscription | @ | VM128 C:\Users\Cléme…ar\src\preload.js:7
  | emit | @ | VM24 node:events:527
  | onMessage | @ | VM126 renderer_init:69
dwiyatci commented 2 months ago

@pavan-world @ClementValot I actually saw more like what Pavan saw in #2103. Just got a plain flat error in the Response panel after firing a request, without any other errors thrown in the console from any JS file.

_Applications_Bruno app_Contents_Resources_app asar_web_index html

Obviously I use bru.setEnvVar in the Pre Request script of my collection, but I believe it doesn't even get to that line of code yet. As of now, v1.13 is unusable for me, hence the downgrading to v1.12.

pavan-world commented 2 months ago

image

I am able to run the same collection in both 1.12.3 and 1.13.1 same time clearly 1.13.1 is throwing the error

"Error invoking remote method 'send-http-request': ReferenceError: setEnvVar is not defined"

looks like the console error exists in both versions...

pavan-world commented 2 months ago

with more testing,

bru.getEnvName()

is causing error in 1.13.1

dwiyatci commented 2 months ago

with more testing,

bru.getEnvName()

is causing error in 1.13.1

Aw ye, I can confirm this! 😮

@pavan-world Would it make sense then to change the title of your issue #2103 to attract more attention, e.g. "Calling bru.getEnvName() in collection's script threw "Error invoking remote method 'send-http-request': ReferenceError: setEnvVar is not defined"", and update the description with your screenshot above (I don't think those errors you saw in the console are relevant tho)?

I just wonder why not so many are reporting this issue up till now 🤔

helloanoop commented 2 months ago

We'll be release a fix for this issue today. We are also adding this into our regression test suite so that we catch these errors in the future

pavan-world commented 2 months ago

looks like this issue is not resolved yet..!

ClementValot commented 2 months ago

Let's let Anoop work his magic 😊

If you need a workaround in the meantime you can substitute bru.getEnvName() with bru.envVariables.__name__

pavan-world commented 2 months ago

this issue is resolved with v1.14.0

BoilingSoup commented 1 month ago

I tried snap package 1.18.0 and AppImage 1.18.1

They both run into this problem immediately