Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emileperron/do-serverless-test-case
DO serverless test case - error returns HTTP 204
https://github.com/emileperron/do-serverless-test-case
Last synced: about 2 months ago
JSON representation
DO serverless test case - error returns HTTP 204
- Host: GitHub
- URL: https://github.com/emileperron/do-serverless-test-case
- Owner: EmilePerron
- License: mit
- Created: 2022-05-20T15:53:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-20T16:07:33.000Z (over 2 years ago)
- Last Synced: 2024-11-07T16:46:04.436Z (3 months ago)
- Language: JavaScript
- Size: 3.09 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DO serverless test case - error returns HTTP 204
This test case contains a function named `test-case` in the `api` package, which runs into an error early on.
Normally, this would result in the function returning an HTTP 400 (Bad Request).
However, if you run this as an App Platform managed function, the function returns an HTTP 204 (No Body).
The Runtime Logs in DO indicate that the function ran successfully, but the Insights tab will indicate that an error is occurring.
## Screenshots of the above claims
I added this test function to my App Platform app, and called it. Here are the results:
HTTP 204 response in Insomnia:
![HTTP 204 response in Insomnia](docs/204-response.png)Logs in DO's Runtime Logs tab indicating a success:
![Logs in DO's Runtime Logs tab indicating a success](docs/runtime-logs.png)Error in DO's Insights tab:
![Error in DO's Insights tab](docs/insights-error.png)---
I also added this test function to my functions sandbox on DO. Here are the results in the UI:
![Sandbox error](docs/sandbox-results.png)## Async vs sync
Making the function non-`async` fixes the issue. So perhaps the issue is related to the way rejected promises are handled in async serverless functions.