restify / node-restify

The future of Node.js REST development
http://restify.com
MIT License
10.71k stars 981 forks source link

TypeError: Cannot set property closed of #<Readable> which has only a getter #1925

Closed ffchristian closed 1 year ago

ffchristian commented 1 year ago

Restify Version: 8.6.1 Node.js Version: v18.*

Expected behaviour

Restify should run through when using node v18

Actual behaviour

/app/node_modules/restify/lib/request.js:848 Request.prototype.closed = function closed() { ^

TypeError: Cannot set property closed of # which has only a getter at patch (/app/node_modules/restify/lib/request.js:848:30) at Object. (/app/node_modules/restify/lib/server.js:33:1) at Module._compile (node:internal/modules/cjs/loader:1149:14) at Module._extensions..js (node:internal/modules/cjs/loader:1203:10) at Module.load (node:internal/modules/cjs/loader:1027:32) at Module._load (node:internal/modules/cjs/loader:868:12) at Module.require (node:internal/modules/cjs/loader:1051:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/app/node_modules/restify/lib/index.js:10:14) at Module._compile (node:internal/modules/cjs/loader:1149:14)

Node.js v18.10.0

Repro case

npm start your app using restify latest (8.6.1) unsing nodeJs v18.*

Cause

node_modules/restify/lib/request.js:848:30 here there is a getter function called ' Request.prototype.closed " I think node in its version 18 uses this in another internal process and gets mixed up

Are you willing and able to fix this?

Yes I found the solution I can make a MR so you guys can add the fix and I can keep using this wonderful framework in my projects.

I'm gonna need access to push the branch and make the MR it's a pretty simple fix you guys can evaluate it.

hmharsh commented 1 year ago

facing the same issue while creating the echo bot by following the steps: https://learn.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-create-bot?view=azure-bot-service-4.0&tabs=javascript%2Cvs#start-your-bot

hmharsh commented 1 year ago

I downgraded the node version and it starts to work

nyvs commented 1 year ago

having the same problem...

nyvs commented 1 year ago

@ffchristian you should do a pull request, so they can fix it

meteorlxy commented 1 year ago

Already a PR there: https://github.com/restify/node-restify/pull/1906

ffchristian commented 1 year ago

I don't have access to the repo thus I cannot make the MR, but in deed there is one already which also tackles the issue

DataKnox commented 1 year ago

facing the same issue while creating the echo bot by following the steps: https://learn.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-create-bot?view=azure-bot-service-4.0&tabs=javascript%2Cvs#start-your-bot

Also why I am here. Using nvm, I installed node v16 and used that, which now works

mmarchini commented 1 year ago

this is fixed on restify 10

Ali-Haider91 commented 1 year ago

I'm facing that issue starting the server with this command "npm start " Request.prototype.closed = function closed() { ^ TypeError: Cannot set property closed of # which has only a getter

tariromukute commented 1 year ago

I'm facing that issue starting the server with this command "npm start " Request.prototype.closed = function closed() { ^ TypeError: Cannot set property closed of # which has only a getter

Try upgrading restify. I got "restify": "^11.1.0" and it works now. Do npm remove restify and the npm i restify. I am using node 18.

Ali-Haider91 commented 1 year ago

I'm facing that issue starting the server with this command "npm start " Request.prototype.closed = function closed() { ^ TypeError: Cannot set property closed of # which has only a getter

Try upgrading restify. I got "restify": "^11.1.0" and it works now. Do npm remove restify and the npm i restify. I am using node 18.

I have already version use "restify : ^11.1.0" till not working, condition luis connectivity.

Ali-Haider91 commented 1 year ago

I also facing this error : WARN: ChatConnector: receive - emulator running without security enabled. ChatConnector: message received. UniversalBot("*") routing "hiih" from "emulator" Session.beginDialog(/) Error at Request._callback (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\lib\dialogs\LuisRecognizer.js:110:31) at self.callback (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\node_modules\request\request.js:185:22) at Request.emit (node:events:513:28) at Request.init (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\node_modules\request\request.js:273:17) at new Request (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\node_modules\request\request.js:127:8) at request (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\node_modules\request\index.js:53:10) at Function.get (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\node_modules\request\index.js:61:12) at LuisRecognizer.recognize (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\lib\dialogs\LuisRecognizer.js:92:21) at LuisRecognizer.onRecognize (C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\lib\dialogs\LuisRecognizer.js:42:32) at C:\Users\Ali Haider\Documents\Project\Nodejs Bot\Ms-Chatbot-nodejs\node_modules\botbuilder\lib\dialogs\IntentRecognizer.js:18:23 / - ERROR: / - Session.endConversation() Session.sendBatch() sending 2 message(s)

Chukarslan commented 10 months ago

Why Jonathan... whaaaay?? :( I loved the Python SDK but I'm forced to use JS - thanks JS devs you're the worst