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.

With timeout: Uncaught TypeError: request.cancel is not a function

See original GitHub issue

When a timeout is set, and when the requested url does not exists or the target server is offline, the request is cancelled with an error:

import Vue from 'vue'
import VueResource from 'vue-resource'

Vue.use(VueResource)

Vue.http.get('http://does-not-exist-or-is-offline.com/something', { timeout: 3000 })
  .then(response => {
    console.log(response)
  }, response => {
    console.log('error')
  })

It returns Uncaught TypeError: request.cancel is not a function and then error

Is it a bug or is there a way to handle this situation?

(UPDATE: i am using ^0.9.1)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
hediicommented, Jul 1, 2016
0reactions
hediicommented, Jul 1, 2016

closed in #311

Read more comments on GitHub >

github_iconTop Results From Across the Web

Canceling request: "r.cancel is not a function" · Issue #1066
I'm trying to cancel an ongoing request like this: const request = got(url, ... but I get TypeError: r.cancel is not a function...
Read more >
Promise - is it possible to force cancel a promise
In modern JavaScript - no. Promises have settled (hah) and it appears like it will never be possible to cancel a (pending) promise....
Read more >
clearTimeout() - Web APIs - MDN Web Docs
The global clearTimeout() method cancels a timeout previously established by calling setTimeout().
Read more >
How to cancel an HTTP request in Node.js - Simon Plenderleith
This allows us to cancel the scheduled timeout by calling the cancelTimeout. abort() method. We do this in the makeRequest() function above ...
Read more >
Timers | Node.js v19.3.0 Documentation
If callback is not a function, a TypeError will be thrown. This method has a custom variant for promises that is available using...
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