Eyyyy, it works! status is now set to enabled, Thank you!
Here’s my solution:
This is mainly for aws lambda, make sure to set the content-type to text/plain, and then for some reason even tho I have set the return on my challenge handler, the function still runs and also returns the 200 at the very bottom so technically I’m also returning a wrong challenge, so just make a response variable at the top and update this inside the challenge function and finally just do one return response at the very end
export const handler = async (event) => {
let response = {
statusCode: 200
}
const bodyObject = JSON.parse(event.body);
const headers = event.headers;
const camelCaseHeader = "Twitch-Eventsub-Message-Type";
const lowerCaseHeader = camelCaseHeader.toLowerCase();
if (headers[camelCaseHeader]) {
handleChallenge(headers[camelCaseHeader]);
} else if (headers[lowerCaseHeader]) {
handleChallenge(headers[lowerCaseHeader]);
}
function handleChallenge(messageType) {
if (messageType == "webhook_callback_verification") {
response = {
statusCode: 200,
headers: {
"content-type": "text/plain"
},
body: bodyObject.challenge
};
}
}
return response;
};
EDIT: I just freaking realize while reading my own post that I’m not actually returning anything on my challenge handler function because that’s a separate function and by default I’m just returning outside of that function ![]()