Comments (7)
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.
@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.
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.
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.
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.
@dougwilson really appreciate the quick response on this and your work on express!
from negotiator.
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)
- Dynamic requires don't support static loaders
- Parameter matching too strict HOT 8
- Fails to parse quoted parameters HOT 10
- Parameter names should be case insensitive HOT 4
- Parameter value case-sensitivity is media-type specific HOT 5
- Is there a reason this library doesn't support charset as a parameter on Accept header? HOT 8
- `Accept: *` results in no media types. HOT 6
- language function does not return expected language HOT 1
- Negotiator behavior on duplicate accept content-types HOT 1
- es6 support HOT 2
- Caching the availableMediaTypes HOT 1
- Functionnal API HOT 2
- Accept-Language comparing standard currently differs between `getLanguagePriority` and `compareSpecs` HOT 5
- [Bug] parseCharset(str, i) changes value of i HOT 4
- [Question] More preferredCharset() stuff HOT 2
- [Question] parseMediaType(), and parameters after q-value HOT 4
- Ship version 1 and adopt semver? HOT 9
- 0.6.3 Release HOT 8
- Inconsistent mediaType/s handling HOT 1
- Returning */* no matter what I set as header. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from negotiator.