Skip to content

[BUG] Improper Error Handling Response in Github Discussions #4577

@Devnil434

Description

@Devnil434

Describe the bug.

There is an issue with the error handling logic in the netlify/functions/github_discussions.ts file.
The function currently returns an incorrectly formatted response object that does not comply with the Netlify Function response structure.
Instead of wrapping the message inside the body property, it directly returns it as a top-level field, which may cause the function to fail or return malformed responses during runtime.

Expected behavior

Expected behavior

The error response should include a properly formatted body property that contains a JSON stringified object.

This ensures the function conforms to Netlify’s expected response format and allows the frontend to parse the error message correctly.

Screenshots

Image

How to Reproduce

Go to the netlify/functions/github_discussions.ts file in the AsyncAPI Website repository.

Trigger a scenario where the GitHub Discussions API call fails (e.g., invalid token or missing permissions).

Observe the Netlify function response — it lacks the body property, causing potential response parsing errors.

🖥️ Device Information [optional]

  • Operating System (OS): Windows 11
  • Browser: Google Chrome
  • Browser Version: 142.0.0.0

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions