bruno icon indicating copy to clipboard operation
bruno copied to clipboard

[Bug] Import collection failed: The Collection file is corrupted

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

Bruno v1.13.1 running on Mac OS 14.4.1

Importing a collection which validates on https://editor.swagger.io/ gives the below error.

Unfortunately it gives no indication of what or where the incompatibility is.

.bru file to reproduce the bug

None available.

Screenshots/Live demo link

Screenshot 2024-04-18 at 12 00 07

NiklasBr avatar Apr 18 '24 10:04 NiklasBr

Same problem on Windows 10 - but I only get "Import collection failed". Opening the console mentions "The Collection file is corrupted", as well as this error:

ValidationError: this field has unspecified keys: type, ignore

VijoPlays avatar Apr 23 '24 10:04 VijoPlays

Hello! I ran into the same problem. As a temporary fix, I manually updated my own collection (json) by following the validations errors in the console.

The chrome console is available in the same menu as the one to create/import collections. In my case there was a couple of validation errors on the type of my requests being invalid, as well as the query field being unspecified. I found the schema definitions here and here.

Specifically I had to:

  • change "type": "http" to "type": "http-request" for all the "request"
  • change "query" to "params"

Hope this helps 🌈

agatheblues avatar Apr 23 '24 14:04 agatheblues

Same issue here. To my case, as the console states - ValidationError: items[14].type must be one of the following values: http-request, graphql-request, folder, where in my case item[14] is sth. like below. It looks like certain 'describing' text. After i deleted it, the import can go on. (not sure any impact from this deletion, but at least the Import can proceed with most your data 'transferred')

   // ... omitted
   {
     "type": "http"
     ...
    },
   {
     "type": "folder"
     ...
    },
    { // item[14]
      "type": "json",
      "name": "bruno",
      "seq": 1
    }
  ],

This could be a workaround before we get a formal fix :)

hmeng1024 avatar Apr 24 '24 08:04 hmeng1024

Same issue here. To my case, as the console states - ValidationError: items[14].type must be one of the following values: http-request, graphql-request, folder, where in my case item[14] is sth. like below. It looks like certain 'describing' text. After i deleted it, the import can go on. (not sure any impact from this deletion, but at least the Import can proceed with most your data 'transferred')

   // ... omitted
   {
     "type": "http"
     ...
    },
   {
     "type": "folder"
     ...
    },
    { // item[14]
      "type": "json",
      "name": "bruno",
      "seq": 1
    }
  ],

This could be a workaround before we get a formal fix :)

This workaround did the job for me ✅

Youcef00 avatar Apr 30 '24 15:04 Youcef00

Still seems to be an issue in v1.16.1 as of 2024-06-05. I found a mix of agatheblues' and hmeng1024's solutions to be the workound for me. Replacing all the "type": "http" with "type": "http-request" and removing the "name": "bruno" entry from the items array allowed me to import the collection.

raworre avatar Jun 05 '24 19:06 raworre

Hi All,

I had the same problem. I remove the below item and it worked for me. { "type": "json", "name": "bruno", "seq": 1 }, Other option is rename type "json" to "folder" Also Use the import option from the left menu. The import option on the main window does not work for me.

dominicvinod012 avatar Jun 05 '24 21:06 dominicvinod012

None of the workarounds seems to do anything with v1.20, I don't even have some of the fields being suggested (such as "type": "http" or "type": "json") in our OpenAPI spec:

Screenshot 2024-07-08 at 12 02 37

Edit: updated to v1.20.2 (12353a3ad) and it also has the same issue

NiklasBr avatar Jul 08 '24 10:07 NiklasBr

Hey @NiklasBr, could you please share the OpenAPI spec with all sensitive values redacted?

sanjai0py avatar Jul 10 '24 10:07 sanjai0py

@sanjai0py api-doc.json

NiklasBr avatar Jul 10 '24 12:07 NiklasBr

Running into a similar issue with 1.20.4, I'm getting Import collection failed: The Collection file is corrupted. In the console I see:

ValidationError: name must be at least 1 character
    at createError (_app-1742de34df20b137.js:31:76737)
    at _app-1742de34df20b137.js:31:77063

This is the spec file: openapi.json

Thanks

niekcandaele avatar Jul 11 '24 18:07 niekcandaele

Updated from v1.20.2 to v1.23.1 but it still has the same problem @sanjai0py.

NiklasBr avatar Aug 06 '24 08:08 NiklasBr

@niekcandaele I found info.title cannot be empty. The error display in the console was "name must be at least 1 character"

So I fixed the error by setting a title.

"info": {
  "title": "Name of my collection",
  "version": "1.0.0"
}

I'm on the 1.23.1 version.

nicolasne avatar Aug 07 '24 06:08 nicolasne

And for @NiklasBr, I quickly check, and I found out that method cannot be "trace" verb. I think this is not supported by Bruno yet.

The message error is "items[10].request.method must be one of the following values: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS"

I advice you to use the web console in bruno and enable the caugth on exception exception. To display the web console, go to View > Toggle Developper Tools. To stop on exception got to the tab Source then go to Breakpoint and check the option Pause on caught exceptions.

Capture d’écran 2024-08-07 à 08 24 45

nicolasne avatar Aug 07 '24 06:08 nicolasne

@niekcandaele I found info.title cannot be empty. The error display in the console was "name must be at least 1 character"

So I fixed the error by setting a title.

"info": {
  "title": "Name of my collection",
  "version": "1.0.0"
}

I'm on the 1.23.1 version.

I still think that Bruno should be able to handle this more gracefully, this spec works with other tools.

This quick fix works for me though, thank you!

niekcandaele avatar Aug 07 '24 06:08 niekcandaele

But TRACE is a valid request method, so why is Bruno throwing an exception?

NiklasBr avatar Aug 07 '24 06:08 NiklasBr

With the release of Bruno v1.25.0, which includes the above fix, all my current technical issues with OpenAPI import has been resolved.

NiklasBr avatar Aug 15 '24 07:08 NiklasBr