We use the Hobby version as we are trying out different providers for current deployments.
Deployment URL: https://wblareporting-backend-dev.vercel.app
(Associated Frontend/Origin): https://wblareporting-dev.vercel.app
Problem: We are consistently receiving an HTTP 500 Internal Server Error response when sending a POST
request to /api/auth/login
on our development deployment (wblareporting-backend-dev.vercel.app
).
Key Issue & Evidence: The primary issue is that despite the client receiving a 500 error, there are absolutely no logs generated in the Vercel Function Runtime Logs corresponding to the execution of the function handling this specific POST /api/auth/login
request.
- Extensive Logging Added: We have added detailed
console.log
statements throughout our Node.js/Express application:- At the very beginning of
app.js
using global middleware (position 0, before CORS and body-parser). - Inside specific middleware (
express-validator
) for the/api/auth/login
route. - Inside the route handler in
routes/authRoutes.js
. - Inside the controller function (
controllers/authController.js
).
- At the very beginning of
- Logs Missing ONLY for Failing Request: While attempting login around Thursday, April 10, 2025, 12:30 PM EDT and 12:38 PM EDT (corresponding roughly to 16:30 UTC and 16:38 UTC), no logs related to
POST /api/auth/login
(e.g.,@@@@ GLOBAL LOGGER START (POS 0): POST /api/auth/login @@@@
) appeared in the Vercel Runtime Logs. - Logs Present for OTHER Requests: During the exact same timeframes, other requests to the same deployment were successfully processed and logged by the same global middleware. For example:
GET /api/health-check
logged successfully around Apr 10 12:30:00 PM EDT (@@@@ GLOBAL LOGGER END (POS 0): GET /api/health-check - Status: 200...
).GET /
logged successfully around Apr 10 12:38:40 PM EDT (@@@@ GLOBAL LOGGER END (POS 0): GET / - Status: 200...
).
- Valid Request Body: We have confirmed via browser developer tools that the request payload being sent is valid JSON (e.g.,
{"login": "user@example.com", "password": "PASSWORD_MASKED"}
). - Minimal Handler Test: A previous test using a minimal handler directly in
authRoutes.js
forPOST /api/auth/login
(which just sentres.status(418).json(...)
) did successfully execute and return the 418 response to the browser, proving the route can be reached by the function under simple conditions. However, restoring the full application logic reintroduced the silent 500 failure.
Conclusion: The evidence strongly suggests that the POST /api/auth/login
request is encountering an error within the Vercel platform/infrastructure before our Node.js application code (app.js
) is successfully invoked or allowed to log, despite the client receiving a 500 status code.