webexsamples / hookbuster Goto Github PK
View Code? Open in Web Editor NEWNode.js console app, that gets around webhooks by running websocket listeners
License: Other
Node.js console app, that gets around webhooks by running websocket listeners
License: Other
I have built hookbuster into a containerized application and have had the container crash with this trace back a few times.
failed to execute Logger#warn RangeError: Maximum call stack size exceeded
hookbuster_1 | at walkAndFilter (/node_modules/@webex/plugin-logger/dist/logger.js:92:23)
hookbuster_1 | at walkAndFilter (/node_modules/@webex/plugin-logger/dist/logger.js:122:23)
Any help will be appreciated. I am not a JS developer unfortunately but i have some inclination that this might be due to a recursion loop.
Thanks in advance!
If hookbuster processes a message containing an Emoji or other double-width unicode characters (emdash, smart quotes, etc) then the Content-Length Header on the generated POST request is smaller than the payload, resulting in truncated json in many web servers.
For example a message containing a single emoji is processed by hookbuster:
INFO: messages:created received
INFO: event forwarded to localhost:8000
INFO: {"createdBy":"<redacted>","orgId":"<redacted>","resource":"messages","ownedBy":"creator","status":"active","created":"2022-06-22T20:05:09.053Z","data":{"id":"<redacted>","roomId":"<redacted>","roomType":"direct","text":"๐","personId":"<redacted>","personEmail":"<redacted>","html":"<h1>๐</h1>","created":"2022-06-22T20:05:31.499Z"},"event":"created","actorId":"<redacted>gtYWVkYi1kMjgzZWM1NGY2Mjc"}
statusCode: 200
The web server receives the request, but the body is truncated so that the ending jc"}
is missing. I took a packet capture and confirmed that the remaining payload is present in the request, but beyond the 802 bytes set by the content length header.
INFO:root:Starting httpd...
INFO:root:POST request,
Path: /
Headers:
Content-Type: application/json
Content-Length: 802
Host: localhost:8000
Connection: close
Body:
{"createdBy":"<redacted>","orgId":"<redacted>","resource":"messages","ownedBy":"creator","status":"active","created":"2022-06-22T20:05:09.053Z","data":{"id":"<redacted>","roomId":"<redacted>","roomType":"direct","text":"๐","personId":"<redacted>","personEmail":"<redacted>","html":"<h1>๐</h1>","created":"2022-06-22T20:05:31.499Z"},"event":"created","actorId":"<redacted>TRlNTgtYWVkYi1kMjgzZWM1NGY2M
127.0.0.1 - - [22/Jun/2022 15:05:35] "POST / HTTP/1.1" 200 -
This discussion on Stack Overflow seems relevant to the issue: https://stackoverflow.com/questions/54369513/how-to-count-the-correct-length-of-a-string-with-emojis-in-javascript
Hi team, I have noticed that when using hookbuster if a webhook being received with a payload more than 1 MB the internal HTTP POST would have the JSON content as truncated which is triggering an exception in backend code, so is this a known issue ? this is happening mostly when my BOT is sending messages into some space the webhook comes for the BIT messages.
I have cloned and followed the same steps, looks like I am having an issue when running in two different machines.|
Not working machine logs
LoggerProxy->warn#NO LOGGER DEFINED
INFO: token authenticated as sushi
Working machine logs
LoggerProxy->warn#NO LOGGER DEFINED
INFO: token authenticated as sushi
INFO: Listening for events from the rooms resource
INFO: Registered handler to forward rooms:created events
INFO: Registered handler to forward rooms:updated events
INFO: Listening for events from the messages resource
INFO: Registered handler to forward messages:created events
INFO: Registered handler to forward messages:deleted events
INFO: Listening for events from the memberships resource
INFO: Registered handler to forward memberships:created events
INFO: Registered handler to forward memberships:updated events
INFO: Registered handler to forward memberships:deleted events
INFO: Listening for events from the attachmentActions resource
INFO: Registered handler to forward attachmentActions:created events
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.