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.
After osprey upgrade from 0.6 to 1.0, we get this error when a request is made:
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 ofheader
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.