Azure / Azure/static-web-apps

All api requests return 404 not found -- can't troubleshoot

Open
#1,554 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

I use NodeJS v4 API functions. If there is an error on the root level of any function (or imported) file, no HTTP handlers are registered, therefore, every request returns 404 Not Found.

However, it is impossible to troubleshoot such errors because they don't show up in the deployment log.

**To Reproduce**
Add the following code to the top of an API function file, before `app.http(...)`:
```
const OpenAI = require('openai');
const openai = new OpenAI({apiKey: process.env.OPENAI_API_KEY});
```
if `OPENAI_API_KEY` is not set in your environment, the function will throw an error and other handlers will not be registered. However, the build log will say that the build was successful.

**Expected behavior**
I expect the build to fail and the build log to contain the description of the error.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.