Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Error: Bad Request when creating Channel/Team/Direct Messages/Discussions

Open moell9 opened this issue 3 years ago • 21 comments

With the latest update of Rocket.Chat I'm getting always the same error: Bad Request This happens when creating a Channel/Team/Direct Messages/Discussions.

What could be the reason ?

moell9 avatar Apr 06 '22 15:04 moell9

Hi, please, provide the infos according to the template. It really help us on keep tracking of versions and other information that may be relevant to debug

Can you open the developer tools in your browser and check, under network, the return of that specific request? Is there any outstanding logs on the server when that exception happens?

dudanogueira avatar Apr 06 '22 21:04 dudanogueira

We have the same problem with our RC instances. I'll fill in the Bug-Report template below @moell9 Feel free to add your infos if they differ from our problem:

Description:

Error Message "Error: Bad request" when creating new Rooms/Teams/Discussions

Steps to reproduce:

  1. Open dialogue to create a new Channel
  2. Enter necessary info and press Create Button

Expected behavior:

New channel is created

Actual behavior:

Error message "Error: Bad request" is shown in the top right. The API-Request to create a channel fails with the response Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined.: Screenshot_20220407_075609 Screenshot_20220407_075718

Server Setup Information:

  • Version of Rocket.Chat Server: 4.6.0
  • Operating System: Ubuntu 18.04
  • Deployment Method: manual
  • Number of Running Instances: 6
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 14.19.1
  • MongoDB Version: 4.2.19

Client Setup Information

Problem is independent from client. It also happens when directly calling the api endpoint to create a channel via e.g. curl

Additional context

We tried replicating this error in a dev instance (built as described here: https://developer.rocket.chat/rocket.chat/rocket.chat-server/linux) using the 4.6.0 tag of the Rocket.Chat github repo but the problem does not happen there.

Relevant logs:

I'm not really sure if these log entries are relevant to this bug but we see a lot of messages like these in the server logs:

{"level":50,"time":"2022-04-07T05:55:10.423Z","pid":28342,"hostname":"rchat1","name":"StreamBroadcast","section":"Stream","msg":"Stream broadcast from 'undefined:3004' to 'localhost:3002' with name local does not exist"} 
{"level":35,"time":"2022-04-07T05:55:43.951Z","pid":28342,"hostname":"rchat1","name":"Meteor","method":"stream:notify-room","userId":null,"remoteIP":null,"instanceId":"3853H4GtFdG8h25ym"} 

wolbernd avatar Apr 07 '22 06:04 wolbernd

Server Setup Information:

Version of Rocket.Chat Server: 4.6.0
Operating System: Ubuntu 20.04 LTS
Deployment Method: manual
NodeJS Version: 14.18.3
MongoDB Version: 5.0.5

Behaviour

Same, as described by wolbernd badrequest

moell9 avatar Apr 07 '22 07:04 moell9

I changed the log level to debug and received the following output after trying to create a new channel:

{"level":35,"time":"2022-04-07T09:04:31.580Z","pid":2133097,"hostname":"xxxxxx","name":"API","method":"POST","url":"/api/v1/groups.create","userId":"xxxxxx","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0","length":"112","host":"localhost:3000","referer":"https://xxxxxx/home","remoteIP":"x.x.x.x","err":{"type":"TypeError","message":"Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined.","stack":"TypeError: Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined.<br> at createRoom (app/lib/server/functions/createRoom.ts:105:10)<br> at MethodInvocation.createPrivateGroup (app/lib/server/methods/createPrivateGroup.js:38:10)<br> at MethodInvocation.methodsMap.<computed> (app/lib/server/lib/debug.js:74:34)<br> at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1885:12)<br> at packages/ddp-server/livedata_server.js:1803:15<br> at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)<br> at packages/ddp-server/livedata_server.js:1801:36<br> at new Promise (<anonymous>)<br> at Server.applyAsync (packages/ddp-server/livedata_server.js:1800:12)<br> at Server.apply (packages/ddp-server/livedata_server.js:1739:26)<br> at Server.call (packages/ddp-server/livedata_server.js:1721:17)<br> at DDPCommon.MethodInvocation.<anonymous> (app/api/server/v1/groups.js:295:17)<br> at packages/dispatch_run-as-user.js:211:14<br> at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)<br> at Object.Meteor.runAsUser (packages/dispatch_run-as-user.js:210:33)<br> at Object.post (app/api/server/v1/groups.js:294:11)<br> at app/api/server/api.js:425:96<br> at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)<br> at Object._internalRouteActionHandler [as action] (app/api/server/api.js:425:39)<br> at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)<br> at packages/rocketchat_restivus/lib/route.coffee:59:33<br> at packages/simple_json-routes.js:100:9<br> => awaited here:<br> at Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12)<br> at Server.apply (packages/ddp-server/livedata_server.js:1752:22)<br> at Server.call (packages/ddp-server/livedata_server.js:1721:17)<br> at DDPCommon.MethodInvocation.<anonymous> (app/api/server/v1/groups.js:295:17)<br> at packages/dispatch_run-as-user.js:211:14<br> at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)<br> at Object.Meteor.runAsUser (packages/dispatch_run-as-user.js:210:33)<br> at Object.post (app/api/server/v1/groups.js:294:11)<br> at app/api/server/api.js:425:96<br> at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)<br> at Object._internalRouteActionHandler [as action] (app/api/server/api.js:425:39)<br> at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)<br> at packages/rocketchat_restivus/lib/route.coffee:59:33<br> at packages/simple_json-routes.js:100:9"},"status":400,"responseTime":13,"msg":"Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined."}

moell9 avatar Apr 07 '22 09:04 moell9

Is this solved with version 4.6.1 ?

moell9 avatar Apr 08 '22 07:04 moell9

@moell9 We just tested this with 4.6.1 and the error is still there.

wolbernd avatar Apr 08 '22 08:04 wolbernd

In case this is relevant:

{"level":40,"time":"2022-04-07T21:55:29.021Z","pid":2150267,"hostname":"xxxxxx","name":"VoIPService","msg":"Voip is not enabled. Cant start the service"} 
{"level":51,"time":"2022-04-07T21:55:29.092Z","pid":2150267,"hostname":"xxxxxx","name":"Migrations","msg":"Not migrating, already at version 258"} 

moell9 avatar Apr 08 '22 14:04 moell9

We can confirm this critical bug in our RC instance after upgrading to 4.6.1

aleadco avatar Apr 09 '22 03:04 aleadco

Here is my error log.

Apr 9 16:04:54 smi rocketchat[1603]: {"level":35,"time":"2022-04-09T20:04:54.523Z","pid":1603,"hostname":"smi","name":"API","method":"POST","url":"/api/v1/groups.create","userId":"GNGoo5iBf6dTjGygg","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36","length":"112","host":"smi.myhost.net","referer":"https://smi.myhost.net/channel/miychannel","remoteIP":"X.X.X.X","err":{"type":"TypeError","message":"Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined.","stack":"TypeError: Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined.\n at createRoom (app/lib/server/functions/createRoom.ts:105:10)\n at MethodInvocation.createPrivateGroup (app/lib/server/methods/createPrivateGroup.js:38:10)\n at MethodInvocation.methodsMap.<computed> (app/lib/server/lib/debug.js:74:34)\n at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1885:12)\n at packages/ddp-server/livedata_server.js:1803:15\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at packages/ddp-server/livedata_server.js:1801:36\n at new Promise (<anonymous>)\n at Server.applyAsync (packages/ddp-server/livedata_server.js:1800:12)\n at Server.apply (packages/ddp-server/livedata_server.js:1739:26)\n at Server.call (packages/ddp-server/livedata_server.js:1721:17)\n at DDPCommon.MethodInvocation.<anonymous> (app/api/server/v1/groups.js:295:17)\n at packages/dispatch_run-as-user.js:211:14\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object.Meteor.runAsUser (packages/dispatch_run-as-user.js:210:33)\n at Object.post (app/api/server/v1/groups.js:294:11)\n at app/api/server/api.js:425:96\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object._internalRouteActionHandler [as action] (app/api/server/api.js:425:39)\n at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)\n at packages/rocketchat_restivus/lib/route.coffee:59:33\n at packages/simple_json-routes.js:100:9\n => awaited here:\n at Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12)\n at Server.apply (packages/ddp-server/livedata_server.js:1752:22)\n at Server.call (packages/ddp-server/livedata_server.js:1721:17)\n at DDPCommon.MethodInvocation.<anonymous> (app/api/server/v1/groups.js:295:17)\n at packages/dispatch_run-as-user.js:211:14\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object.Meteor.runAsUser (packages/dispatch_run-as-user.js:210:33)\n at Object.post (app/api/server/v1/groups.js:294:11)\n at app/api/server/api.js:425:96\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object._internalRouteActionHandler [as action] (app/api/server/api.js:425:39)\n at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)\n at packages/rocketchat_restivus/lib/route.coffee:59:33\n at packages/simple_json-routes.js:100:9"},"status":400,"responseTime":17,"msg":"Cannot destructure property '_USERNAMES' of '_Promise$await' as it is undefined."}

aleadco avatar Apr 09 '22 20:04 aleadco

Enabling the "Enable the App Framework" option solves the problem: изображение But how is the App Framework connect with create chats and rooms?

IgorOhrimenko avatar Apr 11 '22 10:04 IgorOhrimenko

Can someone else (perhaps from the Rocket.Chat team) confirm this way ? What does this setting do exactly ?

moell9 avatar Apr 11 '22 10:04 moell9

@IgorOhrimenko Thanks for that. Enabling the app framework does solve this error for our instances.

I have to admit I don't really understand why the App Framework is needed for rooms/channels. If this is intentional there should be at least a warning on the admin dashboard.

wolbernd avatar Apr 11 '22 11:04 wolbernd

That works here as well. Thank you ...

moell9 avatar Apr 11 '22 13:04 moell9

Hi! Thanks for pointing this out! I'll raise it to our team.

dudanogueira avatar Apr 14 '22 16:04 dudanogueira

Is there a chance to get this merged into 4.6.x? That would be awesome.

hailfinger avatar Apr 22 '22 09:04 hailfinger

this has been merged already and should be shipped into 4.7.X

dudanogueira avatar Apr 22 '22 12:04 dudanogueira

4.5 broke registration with secret URL, 4.6 broke creating rooms, I'm really hesitant to upgrade to 4.7 before I know what will break in 4.7.

hailfinger avatar Apr 22 '22 13:04 hailfinger

@hailfinger So much this. ^^^

Updating Rocket.Chat has become a gamble and reading the change logs at test of fortitude. :( The quality of core functionality of Rocket.Chat as a basic chat platform more and more seems to teeter on a careful balance between "alright" and "annoying bugs". Stability of core functionality should be prioritized over adding an increasing number of "Enterprise" focused functionality.

benedikt-wegmann avatar Apr 22 '22 13:04 benedikt-wegmann

It is unclear to me whether the fix that has been merged into 4.7.0 is just enabling the app framework, or doing something that prevents that from needing to be enabled. Should I enable this setting on 4.6.2 and then disable it once we upgrade to 4.7.0?

mddvul22 avatar May 09 '22 15:05 mddvul22

@mddvul22 I just did a quick test on version 4.7.0 and I can create a new channel even after disabling app framework whereas it fail on version 4.6.3. So it seems issue if fixed on version 4.7.0.

amottier avatar May 12 '22 09:05 amottier

Hello, It works for me, go to Administrator > Permissions > click on [guest or user], then click, "Users in role "; I'm able to add or remove users from here.

Hope it helps. rocket

rolandougalde avatar Sep 23 '22 19:09 rolandougalde

This issue seems fixed by now.

Let us know if you still find it. Thanks!

dudanogueira avatar Feb 23 '23 22:02 dudanogueira