Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove rawdata header #321

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open

remove rawdata header #321

wants to merge 1 commit into from

Conversation

Dancho80
Copy link

No description provided.

@wolfy1339
Copy link
Contributor

We don't send rawdata in the headers, only in the payload. (At least not from what I see)

probot/smee.io@8c33d74

@Dancho80
Copy link
Author

to debug it, we deployed a simple listener that will print the json received:
while true; do { echo -e "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World!"; } | nc -l -p 8080; done
and forwarded GitHub webhook by the smee-client to that listener.
Once receiving the json, we noticed that rawdata is there as a header.
After applying the change as in my PR, the error 431 resolved and the received json looks OK

@wolfy1339
Copy link
Contributor

Can you provide the full complete reproduction steps?

Start with how you set up the server, how did you set up the client, what version of Node are you using?

Any details that can help me debug this, because i would prefer it to be fixed in the server

@Dancho80
Copy link
Author

Dancho80 commented Oct 1, 2024

Server:
ubuntu22.04
nvm use 12

git clone https://github.com/probot/smee.io smee-probot
cd smee-probot
npm install
npm build
pm2 start index.js --name smee-server

Client:

docker run -it node:22 ./bin/bash
git clone https://github.com/probot/smee-client.git
cd smee-client/ && git checkout beta
npm install
npm run build

#to overcome self signed Jenkins:

export NODE_TLS_REJECT_UNAUTHORIZED='0'
node bin/smee.js --url https://<my-smee-server>/<my_channel> --target https://<JenkinsURL>:443/github-webhook/

In Github, editing webhook on any event to send application/json to https://<my-smee-server>/<my_channel>
Webhooks is sent with reply code 200.
https://<my-smee-server>/<my_channel> accepted the webhook properly.
smee-client accepts 431 from Jenkins.

for debugging, instead of sending to Jenkins, I sent to some machine with nc command running (as described above), so I could print the received json:
node bin/smee.js --url https://<my-smee-server>/<my_channel> --target http://myMachine:8080

@wolfy1339
Copy link
Contributor

wolfy1339 commented Oct 11, 2024

Thanks for that. I see how this ended up in the headers.

smee-client/index.ts

Lines 64 to 66 in cc2cf2f

Object.keys(data).forEach((key) => {
headers[key] = data[key];
});

This solution unfortunately does not fix the root cause.

A new solution will have to be found in order to include the raw payload.

https://github.com/probot/smee.io/blob/9fe8e5caf49d6f25887accebae7576206ad770a8/lib%2Fserver.js#L107-L119

GitHub
☁️📦 Webhook payload delivery service. Contribute to probot/smee.io development by creating an account on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants