bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Saved requests in collection are not appearing in the UI

Open Hazz223 opened this issue 1 year ago • 23 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

As of version 1.33.0, creating a new request in a collection will save it to the directory and display it in the UI. When reopening Bruno, the request is no longer there. I can see the .bru file in the directory. Closing and reopening the collection doesn't work. However, creating a new request with the same name as the previous one, doesn't work due to it saying the name has already been taken.

Any one else seen this issue?

I'm using a Macbook Pro 2019, with an intel processor.

.bru file to reproduce the bug

Cannot share.

Screenshots/Live demo link

Will share soon

Hazz223 avatar Oct 15 '24 08:10 Hazz223

I’m experiencing the same issue, and additionally, it also occurs with the saved environments. Could you provide further guidance or support on this?

.bru file to reproduce the bug

Download Reports.bru

Screenshots/Live demo link image image

In this example, the requests for 'Search Items' and 'Download Reports' have been omitted.

s13g3lb4um avatar Oct 16 '24 04:10 s13g3lb4um

i have the same issue. requests are disappearing, sometimes also collections. to get the requests back, i have to close the collections and reload them. very unstable and nearly unusable, had lots of hassle with it. i itried it with downgrading, but it's the same there. since al longer time. i am running ubuntu 24.04 with gnome. are there people without that problem? is bruno still in development? is there a more stable fork?

ulph0 avatar Oct 16 '24 20:10 ulph0

Same issue here. The collection is still in the list after re-opening bruno (1.33), but all requests have disspeared. If I try to open the collection manually I get an error and the console log shows:

ValidationError
    at Object.createError (_app-5b55a57df7ed022e.js:52:106730)
    at Object.test (_app-5b55a57df7ed022e.js:55:18238)
    at validate (_app-5b55a57df7ed022e.js:52:106987)
    at runTests (_app-5b55a57df7ed022e.js:52:104378)
    at _app-5b55a57df7ed022e.js:55:758
    at _app-5b55a57df7ed022e.js:52:104111
    at _app-5b55a57df7ed022e.js:52:104631
    at _app-5b55a57df7ed022e.js:52:107051
407-ca3247c8a0362824.js:1 BrunoError: The Collection file is corrupted
    at 407-ca3247c8a0362824.js:1:6101

yannleretaille avatar Oct 17 '24 05:10 yannleretaille

OK, it seems there were two problems:

  1. the collection had a ":" in the name field set in bruno.json, that's why trying to open it resulted in the validation error above. I had no issues creating the collection with that name before, and I'm not really sure why such a common character is not allowed in the name. And if it really is an issue the creation dialog should not allow it.
  2. now that I manually renamed it, I can get around the bug by closing the collection and re-opening it. If I restart bruno, there will again be zero requests in the collection until I close and re-open it again.

yannleretaille avatar Oct 17 '24 06:10 yannleretaille

Hey @yannleretaille,

Thanks for reporting this bug. There is a high chance that your .bru file is corrupted, as you mentioned. However, for other requests, it must be displayed in the UI. If possible, please attach a .zip file of the lookalike collection that has this bug, or provide us with a solid set of steps to reproduce it.

Pragadesh-45 avatar Oct 17 '24 12:10 Pragadesh-45

when my bru file(s) are corrupt why should they load sometiimes but most of the time not, but when i close the collection and reopen? i can't send my collections, they contain private data. maybe someone else could.

ulph0 avatar Oct 19 '24 19:10 ulph0

same issue here! I think this happend due to syncing issues after using a different code editor like vscode or cursor. I could send you the specific get request file, however I cannot send the whole collection.

ardadylan avatar Oct 20 '24 15:10 ardadylan

Error invoking remote method 'renderer:bru-to-json': Error: Line 11, col 3: 10 | auth: inherit

11 | } when { !bru.getVar('skip_lead_creation') } ^ 12 | Expected end of input, "docs", "tests", "script:post-response", "script:pre-request", "assert", "vars:post-response", "vars:pre-request", "body", "body:multipart-form", "body:form-urlencoded", "body:graphql:vars", "body:graphql", "body:sparql", "body:xml", "body:text", "body:json", "auth:apikey", "auth:wsse", "auth:oauth2", "auth:digest", "auth:bearer", "auth:basic", "auth:awsv4", "headers", "params:query", "params:path", "query", "trace", "connect", "head", "options", "patch", "delete", "put", "post", "get", or "meta"

Found this error in Bruno when I copy pasted my code into Bruno. Basically shouldn't be using a "when" condition within the bruno file structure.

ardadylan avatar Oct 20 '24 15:10 ardadylan

I have the same issue, but re-opening the collection makes everything reappear. PS: just got V 1.33.1 , my issue was resolved in this. PPS: whoops, it did not.

Spark198rus avatar Oct 21 '24 11:10 Spark198rus

Hey everyone,

I completely get how frustrating it can be when requests vanish without an obvious explanation. We're working swiftly to set up an error console at the collection level to show parsing errors, helping you understand why a request might not load.

Thanks for your patience.

helloanoop avatar Oct 26 '24 20:10 helloanoop

ok here my newest observations. i tried all diffent methods of bruno install. since there is no difference in the vanishing effect, i sticked to the flatpak/flathub installation now. when i start bruno over its automatically generated flatpak desktop file (using ubuntu 24.04), the problem appears more often. when i launch it over the command line, less often. sometimes some collections are missing, sometimes some requests, sometimes everything is there. here is the ouput i get when i start it over command line:

[3:1112/204121.071269:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory Preferences file is located at: /home/ulf/.var/app/com.usebruno.Bruno/config/bruno/preferences.json Gtk-Message: 20:41:22.268: Failed to load module "xapp-gtk3-module" Gtk-Message: 20:41:22.329: Failed to load module "canberra-gtk-module" Gtk-Message: 20:41:22.331: Failed to load module "canberra-gtk-module" [3:1112/204122.353557:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory [3:1112/204122.353636:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory watcher add: (several lines of this for all my collections)

ulph0 avatar Nov 12 '24 19:11 ulph0

a friend of mine uses endeavour linux with the arch package of bruno and doesn't have any problem with the disappearing requests/collections issue. i am using the actual ubuntu lts with gnome and the flathub package of bruno and have these problems.

ulph0 avatar Dec 05 '24 14:12 ulph0

I am running Debian Trixie and Bruno v1.36.1. I have a collection with 4 folders. If I open Bruno before VSCode all folders in that collection are available. If I open VSCode first and then Bruno, only the first 2 folders are available. If I close the collection and open it again all folders are available. If I restart Bruno while VSCode is running, again only the first 2 folders are available

georok avatar Dec 16 '24 14:12 georok

Hello I've got a problem like it: since i have installed the 1.36.1 version, all the requests in the root of all my collections are unavailables. I solve it by closing and reopening all the collections i have, one by one.

spernot avatar Dec 17 '24 14:12 spernot

Hi all, I have a similar issue with 1.37 and could reproduce it:

How to reproduce

  • open a completely new test_collection and new test_request
  • go to body and click +Add Param button
  • add a new key with the following value (the important here is to have a new line) {"testkey": "testvalue", "testkey2": "testvalue2"}
  • add to the content-type i.g. "application/json"

image

  • save the test_request
  • close the test_collection
  • reopen the collection
  • go to the request, it doesn't appear any more.

It is the combination of a new line that i pasted, together with a content-typ, which can be saved but no more possible to see after i reopen the collection.

Remark: Adding a new line is impossible via typing; it is only possible via copy-paste. Expected behaviour: Try to enter all possible special characters into the key and value fields; the tool should handle it, especially by closing and reopening the collection.

Regards!

mesopotamiaMD avatar Jan 04 '25 14:01 mesopotamiaMD

As a workaround, I made a quick fix that works for me.

diff --git a/packages/bruno-lang/v2/src/bruToJson.js b/packages/bruno-lang/v2/src/bruToJson.js
index 228691c1..2b04dccd 100644
--- a/packages/bruno-lang/v2/src/bruToJson.js
+++ b/packages/bruno-lang/v2/src/bruToJson.js
@@ -38,7 +38,7 @@ const grammar = ohm.grammar(`Bru {
 
    // Multiline text block surrounded by '''
   multilinetextblockdelimiter = "'''"
-  multilinetextblock = multilinetextblockdelimiter (~multilinetextblockdelimiter any)* multilinetextblockdelimiter
+  multilinetextblock = multilinetextblockdelimiter (~multilinetextblockdelimiter any)* multilinetextblockdelimiter valuechar*
 
   // Dictionary Blocks
   dictionary = st* "{" pairlist? tagend
@@ -162,10 +162,10 @@ const mapRequestParams = (pairList = [], type) => {
 
 const multipartExtractContentType = (pair) => {
   if (_.isString(pair.value)) {
-    const match = pair.value.match(/^(.*?)\s*@contentType\((.*?)\)\s*$/);
-    if (match != null && match.length > 2) {
-      pair.value = match[1];
-      pair.contentType = match[2];
+    const match = pair.value.match(/\s*@contentType\((.*?)\)\s*$/);
+    if (match != null && match.length > 1) {
+      pair.value = pair.value.replace(/\s*@contentType\((.*?)\)\s*$/, '');
+      pair.contentType = match[1];
     } else {
       pair.contentType = '';
     }
@@ -233,13 +233,17 @@ const sem = grammar.createSemantics().addAttribute('ast', {
   },
   value(chars) {
     try {
-      let isMultiline = chars.sourceString?.startsWith(`'''`) && chars.sourceString?.endsWith(`'''`);
+      const regex = /'''(\s*@contentType\((.*?)\)\s*)?$/;
+      let isMultiline = chars.sourceString?.startsWith(`'''`) && chars.sourceString?.match(regex);
       if (isMultiline) {
-        const multilineString = chars.sourceString?.replace(/^'''|'''$/g, '');
-        return multilineString
+        const contentType = chars.sourceString.match(regex)[1];
+        return chars.sourceString
+          .replace(/^'''/, '')
+          .replace(regex, '')
           .split('\n')
           .map((line) => line.slice(4))
-          .join('\n');
+          .join('\n')
+          .concat(contentType || '');
       }
       return chars.sourceString ? chars.sourceString.trim() : '';
     } catch (err) {

macherel avatar Jan 07 '25 15:01 macherel

Having this issue as well 1.39.1, its quite frustrating

tuwid avatar Mar 10 '25 21:03 tuwid

I ran into this problem myself today, and the cause was a newline which somehow got inserted into the value of a query param, which in turn caused an unexpected newline to appear in both the get {} and query{} segments of the .bru file.

Clearing out the newline manually, closing, and re-opening the file sorted it. I'm still not sure how the newline got in there in the first place, maybe a copy/paste glitch.

nicklyra avatar Mar 12 '25 21:03 nicklyra

First time user here experiencing the same issue. Any work arounds until then to fix this?

raunaqss avatar Apr 04 '25 06:04 raunaqss

Another workaround: if you need multiline request components and your request isn't strictly application/json (such as a multipart/form-data request where one part is application/json), is to bounce out your JSON into a file and reference as a file.

waycroft avatar May 12 '25 22:05 waycroft

It happened to me when tests is empty.

tests {
}

Removing it and reopening the UI worked.

ianahilario avatar May 14 '25 02:05 ianahilario

Have the same problem with some GET requests, that had the parameter as long text, pasted as multiline. macOS 15.5

andraz-kozelj avatar May 20 '25 17:05 andraz-kozelj

Hi, the reason is carriage return line feed (CRLF) bruno cannot handle it. if you open the collection with notepad++ and convert all CRLF to only "LF" you will be able to run it.

mesopotamiaMD avatar May 21 '25 07:05 mesopotamiaMD

also see : https://github.com/usebruno/bruno/issues/294

input and output validation, classic issues

VGerris avatar Aug 12 '25 15:08 VGerris

Hi, Bruno 2.6.1 user I had the same issue after creating new requests with IntelliJ. I saw that there was a settings { encodeUrl: true }at the end of my request.bru By suppressing it and reopening Bruno, the issue was solved

POUTOUbarbu avatar Sep 02 '25 08:09 POUTOUbarbu