cloud-native-toolkit / cloud-native-toolkit/planning

ERR_HTTP_HEADERS_SENT in Inventory Micro App - Part 1

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
bug documentation
Dominant language
No language data
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

In Inventory Micro App - Part 1, when testing the Inventory BFF, the `npm start` terminal shows this error when you execute `GET /stock-items` (launched using `http://localhost:3000/api-docs`):
```
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:485:11)
at applyHeaders (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:153:15)
at applyHeaders (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:149:11)
at applyHeaders (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:149:11)
at cors (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:187:7)
at /Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:224:17
at originCallback (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:214:15)
at /Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:219:13
at optionsCallback (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:199:9)
at corsMiddleware (/Users/bwoolf/dev/git/mooc-team-one/inventory-management-bff-bw/node_modules/cors/lib/index.js:204:7)
```

The GET response displays the correct test data, but then something goes wrong with headers.

The Swagger can't be opened with TLS (`https://localhost:3000/api-docs`). For localhost, the browser can’t provide a secure connection.

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.