Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loopback middlewares not working #141

Open
gijo-varghese opened this issue Dec 10, 2018 · 0 comments
Open

Loopback middlewares not working #141

gijo-varghese opened this issue Dec 10, 2018 · 0 comments

Comments

@gijo-varghese
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants