express-gateway
express-gateway copied to clipboard
response-transformer error: Policy Not Found
I have the following gateway.config.yml file
http:
port: 8080
admin:
port: 9876
apiEndpoints:
lags:
path: '/lags/*'
serviceEndpoints:
lags:
url: 'http://lags:50001'
policies:
- response-transformer
- basic-auth
- cors
- expression
- jwt
- log
- oauth2
- proxy
- rate-limit
- verify-auth0-jwt
pipelines:
lags:
apiEndpoints:
- lags
policies:
- log:
- action:
message: ${req.ip} ${req.method} ${req.originalUrl}
- rate-limit:
- action:
max: 1
windowMs: 1000
- jwt:
- action:
secretOrPublicKeyFile: ./key/pubKey.pem
checkCredentialExistence: false
- response-transformer:
- action:
headers:
add:
content-type: "'application/json'"
- verify-auth0-jwt:
- action:
- proxy:
- action:
serviceEndpoint: lags
changeOrigin: true
When I run it, I get this error
api-gateway_1 | error: [EG:policy] Could not find policy response-transformer, Please make sure the plugins providing such policy
api-gateway_1 | is correctly configured in system.config file.
api-gateway_1 | /app/node_modules/express-gateway/lib/policies/index.js:46
api-gateway_1 | throw new Error('POLICY_NOT_FOUND');
api-gateway_1 | ^
api-gateway_1 |
api-gateway_1 | Error: POLICY_NOT_FOUND
api-gateway_1 | at Policies.resolve (/app/node_modules/express-gateway/lib/policies/index.js:46:13)
api-gateway_1 | at /app/node_modules/express-gateway/lib/gateway/index.js:72:29
api-gateway_1 | at Array.forEach (<anonymous>)
api-gateway_1 | at bootstrap (/app/node_modules/express-gateway/lib/gateway/index.js:71:66)
api-gateway_1 | at module.exports (/app/node_modules/express-gateway/lib/gateway/index.js:20:39)
api-gateway_1 | at Main.run (/app/node_modules/express-gateway/lib/index.js:23:43)
api-gateway_1 | at Object.<anonymous> (/app/server.js:6:4)
api-gateway_1 | at Module._compile (node:internal/modules/cjs/loader:1101:14)
api-gateway_1 | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
api-gateway_1 | at Module.load (node:internal/modules/cjs/loader:981:32)
api-gateway_1 | at Function.Module._load (node:internal/modules/cjs/loader:822:12)
api-gateway_1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
api-gateway_1 | at node:internal/main/run_main_module:17:47
It is running in a docker container. I have the latest version of express-gateway defined in my package.json
Try request-transformer