question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Cannot read property 'status' of undefined

See original GitHub issue

Inertia doesn’t handle cases when a request fails without a response (e.g. no network).

In that case the error.response is null. https://github.com/inertiajs/inertia/blob/70b6bda4f23061558d48f91a95baaa9062b9e0bb/src/inertia.js#L83

Suggestion before line 83:

} else if (!error.response) {
    Progress.stop()
     // Should the user be notified somehow?
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
reininkcommented, May 12, 2020

Thanks for reporting this. I agree, we need a better solution here. I plan to get back into some serious Inertia development in June, and I’ll try and tackle this at that time. 👍

2reactions
reininkcommented, Oct 2, 2020

So I believe this has been corrected now. In the event that there is no response, the promise will simply fail, without causing another error.

image

Plus, you can now catch these errors using the new event system:

import { Inertia } from '@inertiajs/inertia'

Inertia.on('error', event => {
  console.log(`An unexpected error occurred during an Inertia visit.`)
  console.log(event.detail.error)

  // Prevent the error from being thrown
  event.preventDefault()
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'status' of ...
'Uncaught TypeError: Cannot read property 'status' of undefined' and it says that this is from sessionChecker. Can someone help me how to ...
Read more >
Cannot read property 'status' of undefined · Issue #352
I got this error when testing over a secure connection. I fixed it by adding NODE_TLS_REJECT_UNAUTHORIZED=0 as an env var on the test...
Read more >
Test Driven Development - Cannot read property 'status' of ...
I found the problem by putting console.log's in everything, and the POST function wasn't being triggered, although it was being triggered with ...
Read more >
Axios - Cannot read property 'status' of undefined
Axios: Uncaught (in promise) TypeError: Cannot read property 'status' of undefined. Hello , When I use axios to create a model I have...
Read more >
TypeError: Cannot read property 'status' of undefined
Hello! I'm trying to use the Metadata Manager for the first time and all was going well until I tried to make the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found