HTTP 400 Error in Google Cloud Function Triggered by Zapier

I’m receiving a 400 error when Zapier invokes my Google Cloud function that transforms markdown text to LaTeX via HTML. How can I troubleshoot this?

import cloud_handler
from mistune import create_markdown
import pypandoc as pdc

@cloud_handler.trigger
def handle_request(req):
    payload = req.get_json(silent=True)
    if payload and "content" in payload:
        raw_content = payload["content"]
        html_output = create_markdown()(raw_content)
        try:
            latex_output = pdc.convert_text(html_output, 'latex', format='html')
        except Exception as error:
            return {"error": f'Conversion failed: {error}'}, 500
        return {"html": html_output, "latex": latex_output}, 200
    return {"error": "Missing content key"}, 400

maybe its formatting issue. check your json headers and make sure zapier sends valid data. add some logs to see what you reciving in the function.