Loopback middlewares not working
Open
Nobody has claimed this yet.
dynamic require
package issue
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Description
Loopback have some inbuilt middlewares that are defined in middleware.json Those aren't working
{
"initial": {
"compression": {},
"cors": {
"params": {
"origin": true,
"credentials": true,
"maxAge": 86400
}
},
"helmet#xssFilter": {},
"helmet#frameguard": {
"params": {
"action": "deny"
}
},
"helmet#hsts": {
"params": {
"maxAge": 0,
"includeSubdomains": true
}
},
"helmet#hidePoweredBy": {},
"helmet#ieNoOpen": {},
"helmet#noSniff": {},
"helmet#noCache": {
"enabled": false
}
},
"session": {},
"auth": {
"loopback#token": {
"params": {
"currentUserLiteral": "me"
}
}
},
"parse": {
"body-parser#json": {},
"body-parser#urlencoded": {
"params": {
"extended": true
}
}
},
"log": {
"./middlewares/debugger": {}
},
"routes": {
"loopback#rest": {
"paths": ["${restApiRoot}"]
}
},
"files": {},
"final:after": {
"./middlewares/error-logger": {}
}
}
Error:
/home/gijo/workspace/hyperloop/dist/index.js:424296
throw err;
^
Error: Cannot resolve path "compression"
at resolveAppPath (/home/gijo/workspace/hyperloop/dist/index.js:424294:15)
at resolveAppScriptPath (/home/gijo/workspace/hyperloop/dist/index.js:424625:22)
at resolveMiddlewarePath (/home/gijo/workspace/hyperloop/dist/index.js:424497:20)
at /home/gijo/workspace/hyperloop/dist/index.js:424415:24
at Array.forEach (<anonymous>)
at /home/gijo/workspace/hyperloop/dist/index.js:424414:18
at Array.forEach (<anonymous>)
at /home/gijo/workspace/hyperloop/dist/index.js:424409:30
at Array.forEach (<anonymous>)
at buildMiddlewareInstructions (/home/gijo/workspace/hyperloop/dist/index.js:424407:15)
at compile (/home/gijo/workspace/hyperloop/dist/index.js:423989:5)
at bootLoopBackApp (/home/gijo/workspace/hyperloop/dist/index.js:395309:22)
at Object.<anonymous> (/home/gijo/workspace/hyperloop/dist/index.js:285422:1)
at Object.<anonymous> (/home/gijo/workspace/hyperloop/dist/index.js:285455:30)
at __webpack_require__ (/home/gijo/workspace/hyperloop/dist/index.js:21:30)
at /home/gijo/workspace/hyperloop/dist/index.js:85:18
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read middleware.json and the resolveAppPath, resolveMiddlewarePath, and buildMiddlewareInstructions stack frames in dist/index.js; compare the configured middleware names with how ncc resolves them. Done means the shown LoopBack configuration no longer fails with “Cannot resolve path compression” in the compiled output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100