[GH-ISSUE #1587] Getting Uncaught TypeError when importing postman json #501

Closed
opened 2026-03-16 15:41:23 +03:00 by kerem · 11 comments
Owner

Originally created by @jainal09 on GitHub (Apr 10, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1587

Describe the bug
A clear and concise description of what the bug is.
I was import a postman collection and got
the following error
Uncaught TypeError: Cannot read property 'raw' of null at f.parsePostmanRequest (3a861b0.modern.js:formatted:5573) at f.parsePostmanCollection (3a861b0.modern.js:formatted:5548) at FileReader.e.onload (3a861b0.modern.js:formatted:5486)
hoppscotch.io-1618064984578.log
possible error here
var r = o.url.raw.match(/^(.+:\/\/[^\/]+|{[^\/]+})(\/[^\?]+|).*$/)

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'collection > import/export collection '
  2. Click on '> import json'
  3. Check Console
  4. See error

Expected behavior
The Postman collection to be imported

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Browser Edge
Originally created by @jainal09 on GitHub (Apr 10, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1587 **Describe the bug** A clear and concise description of what the bug is. I was import a postman collection and got the following error `Uncaught TypeError: Cannot read property 'raw' of null at f.parsePostmanRequest (3a861b0.modern.js:formatted:5573) at f.parsePostmanCollection (3a861b0.modern.js:formatted:5548) at FileReader.e.onload (3a861b0.modern.js:formatted:5486) ` [hoppscotch.io-1618064984578.log](https://github.com/hoppscotch/hoppscotch/files/6290017/hoppscotch.io-1618064984578.log) possible error here `var r = o.url.raw.match(/^(.+:\/\/[^\/]+|{[^\/]+})(\/[^\?]+|).*$/)` **To Reproduce** Steps to reproduce the behavior: 1. Go to 'collection > import/export collection ' 2. Click on '> import json' 3. Check Console 4. See error **Expected behavior** The Postman collection to be imported **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: Windows - Browser Edge
kerem 2026-03-16 15:41:23 +03:00
Author
Owner

@liyasthomas commented on GitHub (Apr 10, 2021):

What was the Postman collection version?

<!-- gh-comment-id:817146065 --> @liyasthomas commented on GitHub (Apr 10, 2021): What was the Postman collection version?
Author
Owner

@jainal09 commented on GitHub (Apr 10, 2021):

V 2.1

<!-- gh-comment-id:817191810 --> @jainal09 commented on GitHub (Apr 10, 2021): V 2.1
Author
Owner

@jainal09 commented on GitHub (Apr 10, 2021):

Okay so when I imported the v2 collection this time there was nothing on console but there was a notification in the web app in red "Import Failed"

<!-- gh-comment-id:817192156 --> @jainal09 commented on GitHub (Apr 10, 2021): Okay so when I imported the v2 collection this time there was nothing on console but there was a notification in the web app in red "Import Failed"
Author
Owner

@jainal09 commented on GitHub (Apr 10, 2021):

This is a test collection (v2)
test_collection.postman_collection.zip
So, v2 fails to import of the above collection however 2.1 of this test collection is imported. But sadly my original v2.1 collection fails to import.

<!-- gh-comment-id:817192792 --> @jainal09 commented on GitHub (Apr 10, 2021): This is a test collection (v2) [test_collection.postman_collection.zip](https://github.com/hoppscotch/hoppscotch/files/6290623/test_collection.postman_collection.zip) So, v2 fails to import of the above collection however 2.1 of this test collection is imported. But sadly my original v2.1 collection fails to import.
Author
Owner

@jainal09 commented on GitHub (Apr 10, 2021):

Okay, so upon further testing I have came to the root cause of the issue!

test.postman_collection.zip
This above collection of V2.1 Fails too. The reason is because it has empty request inside it.
When I mean empty request I mean nothing inside the requests.
image
Also, the error in the console Cannot read property 'raw' of null matches my findings. So, I thing this is a bug that some people may have or may not (if they dont have any empty requests in their collection)

<!-- gh-comment-id:817193999 --> @jainal09 commented on GitHub (Apr 10, 2021): Okay, so upon further testing I have came to the root cause of the issue! [test.postman_collection.zip](https://github.com/hoppscotch/hoppscotch/files/6290644/test.postman_collection.zip) This above collection of V2.1 Fails too. The reason is because it has empty request inside it. When I mean empty request I mean nothing inside the requests. ![image](https://user-images.githubusercontent.com/34179361/114282863-1a162c80-9a64-11eb-9ed3-2caab1be4b2b.png) Also, the error in the console `Cannot read property 'raw' of null` matches my findings. So, I thing this is a bug that some people may have or may not (if they dont have any empty requests in their collection)
Author
Owner

@jainal09 commented on GitHub (Apr 10, 2021):

So, this line github.com/hoppscotch/hoppscotch@b9deec1487/components/collections/ImportExport.vue (L337)
Should first check if url.raw is not null.
Hence to prevent Cannot read property 'raw' of null.

<!-- gh-comment-id:817194737 --> @jainal09 commented on GitHub (Apr 10, 2021): So, this line https://github.com/hoppscotch/hoppscotch/blob/b9deec1487aadc4b7f14d69e7e70568c40c016e0/components/collections/ImportExport.vue#L337 Should first check if `url.raw` is not null. Hence to prevent `Cannot read property 'raw' of null`.
Author
Owner

@jainal09 commented on GitHub (Apr 11, 2021):

@snapeur82 didnt get you man?

<!-- gh-comment-id:817322832 --> @jainal09 commented on GitHub (Apr 11, 2021): @snapeur82 didnt get you man?
Author
Owner

@liyasthomas commented on GitHub (Apr 11, 2021):

Looks like a spam account.

<!-- gh-comment-id:817323531 --> @liyasthomas commented on GitHub (Apr 11, 2021): Looks like a spam account.
Author
Owner

@liyasthomas commented on GitHub (Apr 11, 2021):

So, this line

github.com/hoppscotch/hoppscotch@b9deec1487/components/collections/ImportExport.vue (L337)

Should first check if url.raw is not null.
Hence to prevent Cannot read property 'raw' of null.

@jainal09 can you verify and raise a PR with this fix.

<!-- gh-comment-id:817323980 --> @liyasthomas commented on GitHub (Apr 11, 2021): > So, this line > > https://github.com/hoppscotch/hoppscotch/blob/b9deec1487aadc4b7f14d69e7e70568c40c016e0/components/collections/ImportExport.vue#L337 > > > Should first check if `url.raw` is not null. > Hence to prevent `Cannot read property 'raw' of null`. @jainal09 can you verify and raise a PR with this fix.
Author
Owner

@jainal09 commented on GitHub (Apr 11, 2021):

will try!

<!-- gh-comment-id:817325327 --> @jainal09 commented on GitHub (Apr 11, 2021): will try!
Author
Owner

@jainal09 commented on GitHub (Apr 14, 2021):

https://github.com/hoppscotch/hoppscotch/pull/1593

Done

<!-- gh-comment-id:819213506 --> @jainal09 commented on GitHub (Apr 14, 2021): https://github.com/hoppscotch/hoppscotch/pull/1593 Done
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#501
No description provided.