express-gateway
express-gateway copied to clipboard
Docker Image with connect-redis 4 bug
- Error on startup
gateway | 2020-02-22T14:38:51.318Z [EG:policy] error: Failed to initialize custom express-session store, please ensure you have connect-redis npm package installed
gateway | 2020-02-22T14:38:51.345Z [EG:admin] info: admin http server listening on 0.0.0.0:9876
gateway | (node:1) UnhandledPromiseRejectionWarning: Error: A client must be directly provided to the RedisStore
gateway | at new RedisStore (/usr/local/share/.config/yarn/global/node_modules/connect-redis/lib/connect-redis.js:18:15)
gateway | at Object.module.exports [as routes] (/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/policies/oauth2/oauth2-routes.js:16:43)
gateway | at config.gatewayConfig.policies.config.gatewayConfig.policies.forEach.policyName (/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/gateway/index.js:67:14)
gateway | at Array.forEach (<anonymous>)
gateway | at bootstrapPolicies (/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/gateway/index.js:64:66)
gateway | at bootstrap (/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/gateway/index.js:90:3)
gateway | at module.exports (/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/gateway/index.js:16:10)
gateway | at Main.run (/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/index.js:24:43)
gateway | at [eval]:1:30
gateway | at Script.runInThisContext (vm.js:122:20)
gateway | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
gateway | (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
- system.config.yml
# Core
db:
redis:
host: gateway-db
port: 6379
namespace: EG
#plugins:
# express-gateway-plugin-example:
# param1: 'param from system.config'
crypto:
cipherKey: sensitiveKey
algorithm: aes256
saltRounds: 10
# OAuth2 Settings
session:
storeProvider: connect-redis
storeOptions:
host: gateway-db
port: 6379
secret: keyboard cat
resave: false
saveUninitialized: false
accessTokens:
timeToExpiry: 7200000
refreshTokens:
timeToExpiry: 7200000
authorizationCodes:
timeToExpiry: 300000
Related issue on the connect-redis repo: https://github.com/tj/connect-redis/issues/283
This error won't appear on connect-redis <4, meaning the impelementation needs to be updated
More insight and confirmation: connect-redis 3.4.2 | Works connect-redis 4.0.4(Latest) | Fails
Running v3.4.2 doesn't seem to cause any issues. Have a few containers running.