Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: headers.authorization.startsWith is not a function #219

Closed
TheComfyChair opened this issue Aug 8, 2018 · 5 comments · Fixed by #220
Closed

TypeError: headers.authorization.startsWith is not a function #219

TheComfyChair opened this issue Aug 8, 2018 · 5 comments · Fixed by #220
Labels
bug Something isn't working community integrations

Comments

@TheComfyChair
Copy link

Hi! After updating to 0.5.3, I'm now encountering the following error. I'm running on node 8.9.4 (in docker). 0.5.1 (and 0.5.2) are both behaving as expected.

No custom instrumentation has been used, with only the standard setup outlined here: https://docs.datadoghq.com/tracing/setup/nodejs/

TypeError: headers.authorization.startsWith is not a function at hasAmazonSignature (/home/app/ims-ui/server/node_modules/dd-trace/src/plugins/http.js:116:61) at requestTrace (/home/app/ims-ui/server/node_modules/dd-trace/src/plugins/http.js:39:12) at /home/app/ims-ui/server/node_modules/node-fetch/lib/index.js:1375:15 at new Promise (<anonymous>) at fetch (/home/app/ims-ui/server/node_modules/node-fetch/lib/index.js:1367:9) ...

@rochdev rochdev added bug Something isn't working community integrations labels Aug 8, 2018
@rochdev
Copy link
Member

rochdev commented Aug 8, 2018

The code handling this header actually assumes a string. While this is definitely a bug as it shouldn't crash, I would be interested in knowing what is the use case for setting this header, or headers in general, to a value other than a string.

@clayne11
Copy link
Contributor

clayne11 commented Aug 10, 2018

node-fetch sets headers to arrays rather than strings. I think this should be handled since node-fetch is the defacto fetch library for Node.

Here's an example taken from a fetch call made with node-fetch:

{
  "Content-Type": ["application/json; charset=utf-8"],
  "Authorization": ["Basic 123123123123"],
  "Accept": ["*/*"],
  "Content-Length": ["546"],
  "User-Agent": ["node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"],
  "Accept-Encoding": ["gzip,deflate"],
  "Connection": ["close"]
}

@rochdev
Copy link
Member

rochdev commented Aug 10, 2018

It's fixed in master and will be in the next release :)

@clayne11
Copy link
Contributor

Is that going to be soon? This is a pretty big issue for us.

@rochdev
Copy link
Member

rochdev commented Aug 10, 2018

Just released it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community integrations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants