apicache
apicache copied to clipboard
TypeError: Cannot convert undefined or null to object
I have this issue running the most basic documentation demo (Cache a route):
const express = require('express');
const apicache = require('apicache');
let app = express();
let cache = apicache.middleware;
app.get('/api/collection/:id?', cache('5 minutes'), (req, res) => {
res.json({ foo: 'bar' })
})
Node v11.10.1, Express v4.14.0, apicache v1.5.3
I've narrowed it down:
When I add this prototype it is causing it to fail:
Array.prototype.removeAt = function (iIndex){
var vItem = this[iIndex];
if (vItem) {
this.splice(iIndex, 1);
}
return vItem;
};
When I remove it, program runs normally.
Strange when I change it from "removeAt" to "myRemoveAt" it is still broken, so it's not just the name that matters