Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Lambda Component Update Error 400

Kevin Juma May 10, 2021

I am new to Statuspage and I am currently experiencing an error 400 when I try to update a Statuspage component via AWS Lambda.

This is the code for the lambda function I am using:


import requests
import json

def post_to_statuspage(payload):

headers = {'content-type': 'application/json', 'Authorization': 'Oauth a31d80fb-xxxxxx-xxxxx0849' }
url = ''
return requests.patch(url=url, data=payload, headers=headers)

def package_data(payload):

data = {'event' : payload }
response = post_to_statuspage(json.dumps(data))
return response.status_code

def lambda_handler(event, context):

alerts = event["component"]
status = []
for alert in alerts:

return status

The test event/payload I am using only has the following:

"component": {
"status": "under_maintenance"

Where could the problem be?

2 answers

1 accepted

0 votes
Answer accepted
Kevin Juma May 16, 2021

I figured this out.
I just cleaned up the script.

0 votes
Shubham Aggarwal May 11, 2021

Does it work when you replace

data = {'event' : payload }
response = post_to_statuspage(json.dumps(data))


response = post_to_statuspage(json.dumps(payload))


Kevin Juma May 12, 2021

Thanks for this but no it doesn't.
I am already converting to JSON with my package_data.

Kevin Juma May 12, 2021

I did try replacing as suggested but the error still persists.
Any help with this will be appreciated.

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events