Kubernetes The "url" argument must be of type string. Received undefined.
agusgambina opened this issue · comments
I am getting the following error on Production
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
at validateString (internal/validators.js:122:11)
at Url.parse (url.js:159:3)
at Object.urlParse [as parse] (url.js:154:13)
at /usr/src/app/node_modules/jwks-rsa/src/wrappers/request.js:16:17
at new Promise (<anonymous>)
at module.exports.default (/usr/src/app/node_modules/jwks-rsa/src/wrappers/request.js:10:10)
at JwksClient.getKeys (/usr/src/app/node_modules/jwks-rsa/src/JwksClient.js:36:25)
at JwksClient.getSigningKeys (/usr/src/app/node_modules/jwks-rsa/src/JwksClient.js:54:29)
at JwksClient.getSigningKey (/usr/src/app/node_modules/jwks-rsa/src/JwksClient.js:72:29)
at /usr/src/app/node_modules/jwks-rsa/src/wrappers/rateLimit.js:25:29
I tried to bypass the error by overwriting the req.url
and req.baseURL
app.use('/items', (req, res, next) => {
console.log('*** req.url *** ', req.url)
if (!req.url) {
url = "https://www.example.com"
}
console.log('*** req.baseURL *** ', req.baseURL)
if (!req.baseURL) {
baseURL = "https://api.example.com"
}
console.log('*** req.headers *** ', req.headers)
next();
}, checkJWT, items)
The app is running inside a K8s cluster behind a Digital Ocean load balance / ingress-nginx.
With Auth0 I was able to authenticate in the static frontend. But I am facing this issue when I want to authorize the user in the backend.
Hi @agusgambina - from the stacktrace you've provided, it looks like jwks-rsa
is having trouble finding the URL of your JWKS.
How are you providing the jwksUri
to your JWKS client?
See: https://github.com/auth0/node-jwks-rsa/tree/master/examples/express-demo#jwks-rsa---express-example for an example
Hi @adamjmcgrath thank you for your answer. You were right, I am using dotenv
and I didn't realized that the values in production were not right set. It was that, thanks!