bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Import of freshly exported Bruno Collection fails

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

When importing a Bruno collection that was created using Export (GUI) the collection is not imported and tooltip saying "import collection failed".

The problem has been seen for other collections as well and on different versions v1.12.1, v1.13.0, v1.14.0

How to reproduce (see screenshots)

  1. Chose to Export the Collection
  2. Closed the Collection
  3. Chose to import Bruno Collection using the "three dots"
  4. Selected the json file cerated under step 1
  5. Received error tooltip saying "import collection failed"

.bru file to reproduce the bug

No response

Screenshots/Live demo link

1Export

2SelectingBrunoExport

3ImportUsingThreeDots

4SelectingBrunoCollection

5ErrorTooltip

angelaatskandia avatar Apr 26 '24 15:04 angelaatskandia

Is this failure not caused because the collection exported and the collection being imported have the same name?

DmytroCrawford avatar Apr 26 '24 19:04 DmytroCrawford

Is this failure not caused because the collection exported and the collection being imported have the same name?

No this looks like a parsing issue. I tried it with bruno-testbench collection. When exporting/importing, this error is dumped in the console

ValidationError: items[5].type must be one of the following values: http-request, graphql-request, folder
    at Object.createError (_app-9570891bf88d2432.js:36:69067)
    at Object.test (_app-9570891bf88d2432.js:39:3708)
    at validate (_app-9570891bf88d2432.js:36:69324)
    at runTests (_app-9570891bf88d2432.js:36:66715)
    at _app-9570891bf88d2432.js:39:758
    at _app-9570891bf88d2432.js:36:66448
    at _app-9570891bf88d2432.js:36:66968
    at _app-9570891bf88d2432.js:36:69388
897-fea41f0406a7d7c9.js:1 BrunoError: The Collection file is corrupted
    at 897-fea41f0406a7d7c9.js:1:5447

Looking at the JSON file, the sixth element look like this

  {
      "type": "json",
      "name": "bruno",
      "seq": 1
    }

After removing it, the collection imports just fine, also with the same name. Looks like the importer doesn't like the type attribute json, as it expects http-request, graphql-request, folder.

I'd gladly try to fix this, but I'm not sure how to deal with this element. I'm wondering about the intention of that item:

  • Should it be excluded during the export?
  • Should it be ignored while importing?
  • Should it be considered on import, and what does it do?

This is the unmodified exported collection: bruno-testbench-source.json

krummbar avatar Apr 27 '24 03:04 krummbar

Closing this as the issue has already been fixed. Thank you all for taking the time to report the bug!

sanjai0py avatar Jul 24 '24 12:07 sanjai0py