mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 08:45:58 +03:00
[GH-ISSUE #1587] Getting Uncaught TypeError when importing postman json #501
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#501
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
Expected behavior
The Postman collection to be imported
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
@liyasthomas commented on GitHub (Apr 10, 2021):
What was the Postman collection version?
@jainal09 commented on GitHub (Apr 10, 2021):
V 2.1
@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"
@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.
@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.
Also, the error in the console
Cannot read property 'raw' of nullmatches 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)@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.rawis not null.Hence to prevent
Cannot read property 'raw' of null.@jainal09 commented on GitHub (Apr 11, 2021):
@snapeur82 didnt get you man?
@liyasthomas commented on GitHub (Apr 11, 2021):
Looks like a spam account.
@liyasthomas commented on GitHub (Apr 11, 2021):
@jainal09 can you verify and raise a PR with this fix.
@jainal09 commented on GitHub (Apr 11, 2021):
will try!
@jainal09 commented on GitHub (Apr 14, 2021):
https://github.com/hoppscotch/hoppscotch/pull/1593
Done