Skip to content

Import Bruno Collection fails - ValidationError: headers are required #2583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
sigiswald opened this issue Jul 8, 2024 · 5 comments · Fixed by #2601
Closed
2 tasks done

Import Bruno Collection fails - ValidationError: headers are required #2583

sigiswald opened this issue Jul 8, 2024 · 5 comments · Fixed by #2601
Labels
bug Something isn't working

Comments

@sigiswald
Copy link

I have checked the following:

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

Describe the bug

Bruno v1.20.2 (and also v1.20.1) on Windows.

  • Create a new Collection called "test"
  • Add a single request called "test" and URL GET "http://localhost:8080/api/test"
  • Save the request and export as a Bruno Collection which creates a test.json file.
  • Close the collection and delete it from from the file system (to avoid naming conflicts).
  • Import the test.json file as a Bruno Collection.
  • Error: Import collection failed.
ValidationError: headers are required
    at createError (_app-0ccfd746ec8354d9.js:31:76737)
    at _app-0ccfd746ec8354d9.js:31:77063
656-083d4e6188257160.js:1 BrunoError: The Collection file is corrupted
    at 656-083d4e6188257160.js:1:6056

test.json

{
  "name": "test",
  "version": "1",
  "items": [
    {
      "type": "http",
      "name": "test",
      "seq": 2,
      "request": {
        "url": "http://localhost:8080/api/test",
        "method": "GET",
        "headers": [],
        "params": [],
        "body": {
          "mode": "none",
          "formUrlEncoded": [],
          "multipartForm": []
        },
        "script": {},
        "vars": {},
        "assertions": [],
        "tests": "",
        "auth": {
          "mode": "none"
        }
      }
    }
  ],
  "environments": [],
  "root": {
    "request": {
      "auth": {
        "mode": "none"
      }
    },
    "meta": {
      "name": "test"
    }
  },
  "brunoConfig": {
    "version": "1",
    "name": "test",
    "type": "collection",
    "ignore": [
      "node_modules",
      ".git"
    ]
  }
}

Exporting/importing as a Postman collection works fine.

Kind regards,
/Sigiswald

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

@sigiswald sigiswald added the bug Something isn't working label Jul 8, 2024
@sfreeman422
Copy link
Contributor

+1 similar scenario occurring for me on Ubuntu. I have a more complex collection but still see the same error that @sigiswald is seeing as well.

@mdxs
Copy link

mdxs commented Jul 9, 2024

+1 confirmed same scenario / bug; seen both on:

  • Linux Mint using Apt download; and also on
  • Windows using Windows x64 Portable download

In both cases using Bruno v1.20.2 with:

  • electron : 21.1.1
  • chrome : 106.0.5249.103
  • node : 16.16.0
  • v8 : 10.6.194.17-electron.0

@mdxs
Copy link

mdxs commented Jul 9, 2024

I've found a workaround (based on seeing the PR in #2598).

When the bug is seen, manually edit the export JSON before attempting to import again. Such that there is at least an empty array on the root.request.headers path, like:

  "root": {
    "request": {
      "headers": [],
      "auth": {
        "mode": "none"
      }
    },
    "meta": {
      "name": "test"
    }
  },

For the example scenario in this report, this workaround allowed me to import the "test.json" Bruno collection.

It also worked for me (using Bruno v1.20.2) in a more complex Bruno collection exported on Windows and imported in Linux (after applying this workaround).

@sfreeman422
Copy link
Contributor

Nice! That seems like it would satisfy the current .required aspect you recognized on my PR (#2598). I would imagine my PR fixes a regression but will wait for others to chime in.

@sigiswald
Copy link
Author

Thank you @sfreeman422 and @mdxs !!! Your analysis, feedback and certainly the PR is much appreciated!

helloanoop pushed a commit that referenced this issue Jul 10, 2024
…#2583  (#2598)

* Removed headers key on folderRootSchema as it seems unlikely that headers are actually required here

* Removed launch.json

* Added back package-locks

* reverted package-lock

* removed only the .required
jwetzell pushed a commit to jwetzell/bruno that referenced this issue Aug 2, 2024
…usebruno#2583  (usebruno#2598)

* Removed headers key on folderRootSchema as it seems unlikely that headers are actually required here

* Removed launch.json

* Added back package-locks

* reverted package-lock

* removed only the .required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants