Skip to content

Custom Integration content_raw possible regression #10153

@cinderblock

Description

@cinderblock

Description:

Custom Integration request.content_raw does not contain request.

Maybe I'm doing something stupid but I can't figure this out.

I'm trying to create a simple custom integration that accepts text/plain content. I cannot get raw request information as expected in content_raw. I seem to get a String with value [object Object].

My first thought was that it was some complex, possibly self referencing object (where I've seen similar issues before), and the implicit toString() was not working as expected. However, inspecting this further, typeof request.content_raw == 'string'. This indicates that something inside Rocket.Chat is not passing along the raw request body correctly.

I have tried multiple Content-Type headers with curl. In no case that I've tried does the content_raw not contain the String [object Object]. Using Content-Type: text/plain, I can see that request.content is an empty object.

I could possibly wrap my plain text as a trivial JSON object to get the data to at least show up in request.content but I don't have very good controls on the process that generates these http requests so I'd rather not.

This might be related to #2543 however I'm betting this was a regression caused by some other change as that issue was getting undefined values for content_raw and that issues seems to have been specifically fixed.

Server Setup Information:

�[34mI20180316-00:17:23.417(3) �[32m➔ �[32m+----------------------------------------------------+ 
�[34mI20180316-00:17:23.418(3) �[32m➔ �[32m|                   SERVER RUNNING                   | 
�[34mI20180316-00:17:23.418(3) �[32m➔ �[32m+----------------------------------------------------+ 
�[34mI20180316-00:17:23.419(3) �[32m➔ �[32m|                                                    | 
�[34mI20180316-00:17:23.419(3) �[32m➔ �[32m|  Rocket.Chat Version: 0.62.2                       | 
�[34mI20180316-00:17:23.419(3) �[32m➔ �[32m|       NodeJS Version: 8.9.4 - x64                  | 
�[34mI20180316-00:17:23.420(3) �[32m➔ �[32m|             Platform: linux                        | 
�[34mI20180316-00:17:23.420(3) �[32m➔ �[32m|         Process Port: 3001                         | 
�[34mI20180316-00:17:23.421(3) �[32m➔ �[32m|             Site URL: https://chat.mydomain.com/  | 
�[34mI20180316-00:17:23.421(3) �[32m➔ �[32m|     ReplicaSet OpLog: Disabled                     | 
�[34mI20180316-00:17:23.422(3) �[32m➔ �[32m|          Commit Hash: 07f0e3f77c                   | 
�[34mI20180316-00:17:23.422(3) �[32m➔ �[32m|        Commit Branch: HEAD                         | 
�[34mI20180316-00:17:23.422(3) �[32m➔ �[32m|                                                    | 
�[34mI20180316-00:17:23.423(3) �[32m➔ �[32m+----------------------------------------------------+ 
  • Version of Rocket.Chat Server: 0.62.2
  • Operating System: CentOS Linux release 7.4.1708 (Core)
  • Deployment Method(snap/docker/tar/etc): tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Disaabled
  • Node Version: 8.9.4 - x64
  • mongoDB Version: db version v2.6.12

Steps to Reproduce:

  1. Create new Integration
  2. Modify Script to log content_raw: console.log(request.content_raw)
  3. Enable Integration
  4. Test Integration (with example curl command that sends JSON)
  5. Observe {"success":true} response to curl request

Expected behavior:

  1. Raw POST data is printed in logs

Actual behavior:

  1. [object Object] is printed in logs

Relevant logs:

�[34mI20180316-00:18:35.234(3) [object Object] 
�[34mI20180316-00:21:39.250(3) [object Object] 
�[34mI20180316-00:22:20.780(3) [object Object] 
�[34mI20180316-00:22:49.181(3) [object Object] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions