Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

TypeError: request.header is not a function #221

Open
rohshall opened this issue Feb 7, 2021 · 0 comments
Open

TypeError: request.header is not a function #221

rohshall opened this issue Feb 7, 2021 · 0 comments

Comments

@rohshall
Copy link

rohshall commented Feb 7, 2021

After osprey upgrade from 0.6 to 1.0, we get this error when a request is made:

TypeError: request.header is not a function
	at requireProxySiteAdminPermissionMiddleware (/opt/service/lib/common/proxy-permission-middleware.js:24:29)
	at Layer.handle [as handle_request] (/opt/service/node_modules/express/lib/router/layer.js:95:5)
	at next (/opt/service/node_modules/express/lib/router/route.js:137:13)
	at asapAuthorizationMiddleware (/opt/service/node_modules/@atlassian/express-asap/lib/asap-issuer-whitelist-middleware.js:13:20)
	at Layer.handle [as handle_request] (/opt/service/node_modules/express/lib/router/layer.js:95:5)
	at next (/opt/service/node_modules/express/lib/router/route.js:137:13)
	at Route.dispatch (/opt/service/node_modules/express/lib/router/route.js:112:3)
	at Layer.handle [as handle_request] (/opt/service/node_modules/express/lib/router/layer.js:95:5)
	at /opt/service/node_modules/express/lib/router/index.js:281:22
	at param (/opt/service/node_modules/express/lib/router/index.js:354:14)

Digging a little in the code, we found that osprey 1.0 uses newer osprey-method-handler package which sets header of the request object with an object that represents sanitized headers:
osprey-method-handler setting of header

The issue is express app expects header to be a function, not an object, and we get this error, because some middleware down the line in the chain fails.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant