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.

TypeMismatchedError on Edge

See original GitHub issue

I am running my website with Edge on Window 10. Here is the code the produce the TypeMismatchedError, code: 17

return new Promise((resolve, reject) => {
    return fetch('/api/search/trips', {
      method: 'POST',
      headers: {
        "x-access-token": "example-key",
        'Accept': 'application/json',
        'Content-Type': 'application/json; charset=utf-8'
      },
      body: JSON.stringify(searchData)
    })
    .then(response => response.json())
    .then(json => resolve(json))
    .catch(err => reject(err))
  })

This code throws TypeMismatched exception before any request could be fired. I write it with Webpack.

It works fine in other Chrome, Firefox and Safari. Do you have any idea ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Titozzzcommented, Sep 12, 2016

I have the exact same problem. But I guess the answer is does not have to be on this repo but rather around here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8546263/

1reaction
dgrahamcommented, Sep 7, 2016

Try running the fetch call from within Edge’s web console to isolate the code without other dependencies like Webpack.

This handler needs to detect if the request returned a successful response before consuming the JSON response body.

.then(response => response.json())

should be something like this

.then(response => {
  if (response.ok) {
    return response.json()
  } else {
    // HTTP status code not in 200-299 success range
    // Could be 401, 404, 500, etc.
  }
})

Fetch only invokes the catch handler in cases where a Response cannot be created, like network failures, for example. If the HTTP request and response cycle succeeded, the then handler is invoked, even if the HTTP status code is a failure.

Edge has a native implementation of window.fetch and does not use this polyfill code, so I’ll close out this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compile error: Type mismatch Help - Microsoft Community
When I try to run it, I get the message "compile error: type mismatch," and when I use the debugger it highlights in...
Read more >
error: Type Mismatch - education edge
When running the Requirement Audit Report for specific students, Users may receive the following: Error: Type Mismatch. This error can occur when the...
Read more >
Resolving a "type mismatch" error : - Omatic Support
Hi all, Have just added a few static fields to a profile (which worked before) and now get an error for each record....
Read more >
scala type mismatch error in graphX code - Stack Overflow
The first is a common problem with + in Scala, unfortunately. In this case you have not k -> (v + edge.attr) ,...
Read more >
Type-Mismatch Error - ISACA
Sometimes, while writing code, programmers may ask that a value be stored in a variable that is not typed correctly, such as putting...
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 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