GithubHelp home page GithubHelp logo

toLowerCase of undefined about negotiator HOT 7 CLOSED

jshttp avatar jshttp commented on July 19, 2024
toLowerCase of undefined

from negotiator.

Comments (7)

dougwilson avatar dougwilson commented on July 19, 2024

Would you be able to post a standard-formatted stack trace or code to reproduce? Either of those two would help a lot :)

from negotiator.

NoumanSaleem avatar NoumanSaleem commented on July 19, 2024

@dougwilson wish I had some more context around this. Unfortunately just have the error itself. I'll be doing some more digging into reproducing this. Hope the slightly better (maybe not) formatting helps :)

It happened in an express web application (express v4.8.7)

thanks!

trace=[
    column=54,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js,
    function=null,
    line=81,
    method=null,
    native=false,
    column=null,
    file=null,
    function=Array.every,
    line=null,
    method=every,
    native=true,
    column=14,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js,
    function=specify,
    line=80,
    method=null,
    native=false,
    column=12,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js,
    function=accepted.map.filter.sort.s,
    line=48,
    method=map.filter.sort.s,
    native=false,
    column=null,
    file=null,
    function=Array.map,
    line=null,
    method=map,
    native=true,
    column=20,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js,
    function=getMediaTypePriority,
    line=47,
    method=null,
    native=false,
    column=21,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js,
    function=provided.map.filter.sort.pa,
    line=101,
    method=map.filter.sort.pa,
    native=false,
    column=null,
    file=null,
    function=Array.map,
    line=null,
    method=map,
    native=true,
    column=21,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js,
    function=preferredMediaTypes,
    line=100,
    method=null,
    native=false,
    column=12,
    file=/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/negotiator.js,
    function=Negotiator.(anonymousfunction),
    line=26,
    method=(anonymousfunction),
    native=false
],
stack=[
    TypeError: Cannotcallmethod'toLowerCase'ofundefined,
    at/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js: 81: 54,
    atArray.every(native),
    atspecify(/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js: 80: 14),
    ataccepted.map.filter.sort.s(/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js: 48: 12),
    atArray.map(native),
    atgetMediaTypePriority(/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js: 47: 20),
    atprovided.map.filter.sort.pa(/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js: 101: 21),
    atArray.map(native),
    atpreferredMediaTypes(/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js: 100: 21),
    atNegotiator.(anonymousfunction)(/app/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/negotiator.js: 26: 12)
]

from negotiator.

dougwilson avatar dougwilson commented on July 19, 2024

I think this error is because you are adding an enumerable property on Object.prototype, which will wreck havoc in all sorts of weird places. Would you be willing to show the output of the following within your application's code?

console.dir(Object.prototype)

from negotiator.

dougwilson avatar dougwilson commented on July 19, 2024

Nevermind, I have determined the cause and it's from an invalid media type most likely. Example: text/html; foo (foo at the end is invalid because it needs to be a key value pair).

from negotiator.

dougwilson avatar dougwilson commented on July 19, 2024

OK, so what I believe was causing your issue should be resolved now. I'll issue out a new version of this module and accepts module and you should be able to npm update your express install to pull it in.

from negotiator.

NoumanSaleem avatar NoumanSaleem commented on July 19, 2024

@dougwilson really appreciate the quick response on this and your work on express!

from negotiator.

dougwilson avatar dougwilson commented on July 19, 2024

You're welcome :) And let me know if you're still seeing this error pop up, even after updating accepts to 1.1.2, since I fixed a error with the same stack trace you provided, but cannot be 100% sure it fixed your issue :)

from negotiator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.