restify / node-restify

The future of Node.js REST development

Home Page:http://restify.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ffchristian opened this issue · comments

  • Used appropriate template for the issue type
  • Searched both open and closed issues for duplicates of this issue
  • Title adequately and concisely reflects the feature or the bug

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.

I downgraded the node version and it starts to work

commented

having the same problem...

commented

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

Already a PR there: #1906

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

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

this is fixed on restify 10

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

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'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.

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)

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