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.

TypeError: undefined is not a constructor (evaluating 'new Headers({ ... , ... })')

See original GitHub issue

“react”: “16.0.0-alpha.3”, “react-native”: “0.44.0”, “react-native-fcm”: “^10.0.3”,

Running on iPhone6 OS v10.2.1

I am able to receive remote notifications when using the Firebase console cloud messaging. However, I am unable to invoke the messages manually using the ios example code(firebaseClient.js)

let headers = new Headers({
          "Content-Type": "application/json",
          "Authorization": "key=" + FirebaseConstants.KEY
  	});```

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
atpunkcommented, Dec 15, 2017

Issue Solved.

I was unclear on which key to use in the FirebaseConstants.js

I was using my Web API Key when I actually needed my Project Settings->Cloud Messaging->Server Key.

0reactions
evollucommented, Dec 13, 2017
  1. Header is not a constructor so you need to fix your code. check fetch library document
  2. as you can see, you are getting 401 error from firebase so no notification.

nothing to do with versions

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Javascript TypeError: undefined is not a constructor ...
and I'm just creating with: const home = new GameTeam('name', 'null');. I ...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
TypeError:undefined is not a constructor (cordova - iOS)
Hello All,. I have an issue to display google map with multiple marker. When I use, var baseArrayClass = new plugin.google.maps.BaseArrayClass(data_array);
Read more >
Top 10 JavaScript errors from 1000+ projects (and ... - Rollbar
1. Uncaught TypeError: Cannot read property · 2. TypeError: 'undefined' is not an object (evaluating · 3. TypeError: null is not an object...
Read more >
undefined is not an object (evaluating 'response.data')
Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'response.data') ; export default ; props: ['message'] ; data() { return ; body:...
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