TypeError: Cannot assign to read only property 'callback' of decr
See original GitHub issue- Version: node redis 2.6.2
- Platform: Node 4.4.5 on Ubuntu 14.04
- Description: I keep getting this error while trying to decrement a simple online counter in redis:
TypeError: Cannot assign to read only property 'callback' of decr
at RedisClient.internalSendCommandWrapper (/home/alex/node_modules/newrelic/lib/instrumentation/redis.js:76:22)
at RedisClient.wrappedFunction [as internal_send_command] (/home/alex/node_modules/newrelic/lib/transaction/tracer/index.js:354:24)
at RedisClient.(anonymous function).RedisClient.(anonymous function) (/home/alex/node_modules/redis/lib/commands.js:45:25)
at Socket.eval (eval at <anonymous> (/home/alex/server2.js:2:52), <anonymous>:2456:12)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Socket.emit (/home/alex/node_modules/socket.io/lib/socket.js:128:10)
at Socket.onclose (/home/alex/node_modules/socket.io/lib/socket.js:425:8)
at Client.onclose (/home/alex/node_modules/socket.io/lib/client.js:232:24)
at Client.onerror (/home/alex/node_modules/socket.io/lib/client.js:213:8)
The code is:
db.decr('online',function(err){
if(err){
console.log('DECREMENTING ONLINE NUMBER FAILED:');
console.log(err);
}
console.log('DECREMENTING ONLINE NUMBER WAS SUCCESSFUL!');
});
I can’t seem to replicate it, but it only happens when lots of people are on the site. When it’s only me and a couple of friends testing it it seems to do the job just fine incrementing and decrementing the value.
By the way it happens even without the callback function (just db.decr(‘online’)), I only added the callback to see if it would throw any errors.
I repeat, the code works fine until more people start using it. Maybe it’s trying to do .decr at the same time and it can’t handle that or?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot assign to read only property
When you use Object.defineProperties , by default writable is set to false , so _year and edition are actually read only properties.
Read more >Cannot assign to read only property of Object in TypeScript
The TypeScript error "Cannot assign to read only property of object" occurs when we try to change a property of a frozen object...
Read more >[Cannot assign to read only property '<field_name>' of object ...
This type of error(Cannot assign to read-only property) generally occurs on update of public property @api decorator variable value.
Read more >TypeError: "x" is read-only - JavaScript - MDN Web Docs
The JavaScript strict mode-only exception "is read-only" occurs when a global variable or object property that was assigned to is a read-only property....
Read more >Zoom SDK Cannot assign to read only property 'video' of ...
Dear , i got this Error “Cannot assign to read only property 'video' of object '[object Object]” any one can help Plz :slight_smile:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just hit this problem with
redis@2.6.0-2
andnewrelic@1.28.3
. Setting newrelic back to 1.28.0 removed the issue.However, using redis 2.6.2 and newrelic 1.28.3 works fine.
This seems to be a issue with newrelic, so I recommend to contact them about this. I’m sorry that I can’t help you any more, as I do not use newrelic on my own.