ForestAdmin / forest-express

🧱 Dependency of Express Lianas for Forest Admin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redirect_uri always return http://localhost:3310

arjunpswork40 opened this issue · comments

Expected behavior

When setting APPLICATION_URL need to replace http://localhost:3310 with the URL mentioned as APPLICATION_URL on .env file.
redirect_uri should use this APPLICATION_URL

Actual behavior

APPLICATION_URL always return http://localhost:3310

Failure Logs

https://api.forestadmin.com/oidc/auth?client_id=eyJraWQiOiJFN3E2Q0FWNGxuWUtwNmdPTlFiaWlZOFhVUDVWSHhmS21VUHZRSnV0Q1Q4IiwiYWxnIjoiUlMyNTYifQ.eyJyZWRpcmVjdF91cmlzIjpbImh0dHA6Ly9sb2NhbGhvc3Q6MzMxMC9mb3Jlc3QvYXV0aGVudGljYXRpb24vY2FsbGJhY2siXSwidG9rZW5fZW5kcG9pbnRfYXV0aF9tZXRob2QiOiJub25lIiwiYXBwbGljYXRpb25fdHlwZSI6IndlYiIsImdyYW50X3R5cGVzIjpbImF1dGhvcml6YXRpb25fY29kZSJdLCJyZXNwb25zZV90eXBlcyI6WyJjb2RlIl0sImVudmlyb25tZW50X2lkIjoxMzA5MTEsImlzcyI6IkZPUkVTVF9BVVRIRU5USUNBVElPTl9TWVNURU0ifQ.l_PY4b6LQ5oQTrt_fqNs3FaQnHFmx6FTJVP8QFZKmZChBWcqKM6zBnh8cheewvxH_2p10qtqjjOhvQILPgnbm49p2dK-uKeLJQmfKXmIa55isgF3BiI3r06hPsnCtB6sLHvgqaO3dPvOCh7ggAv_SdcCa8K2CfiKssPT3PnZEwOvajBgKkuP4hEij2vUKYnmsA-YvSje3048KHZxypVYgFtpb962Lv5X4-r444y4j5TCHDAZsIcL6e45oUfhY1zTZWYyCjzgFEqAo64HF_TOv_WA0NPbtXYhgza58dWfJmawtNiO2dC9MI1uYdGh_eFSxpHV69c5rtJNybYpRWfdbQ&scope=openid email profile&response_type=code&redirect_uri=http://localhost:3310/forest/authentication/callback&state={"renderingId":194334}

Context

When reading core files finds that "require('dotenv'):config();" was missing inside /node_modules/forest-express/dist/context/init.js. So the env file was not loded.

init.js is seen after "npm run build" on server. On repository and in file in my local machine, seen this code in/node_modules/forest-express/dist/context/build-values.js

insde build-values.js the portion
module.exports = function (context) {
return context.addInstance('env', function () {
return _objectSpread(_objectSpread({}, process.env), {}, {
FOREST_URL: process.env.FOREST_URL || 'https://api.forestadmin.com',
JWT_ALGORITHM: process.env.JWT_ALGORITHM || 'HS256',
NODE_ENV: ['dev', 'development'].includes(process.env.NODE_ENV) ? 'development
Screenshot from 2023-04-13 17-09-14
Screenshot from 2023-04-13 17-08-03
' : 'production',
APPLICATION_URL: process.env.APPLICATION_URL || "http://localhost:".concat(process.env.APPLICATION_PORT || 3310)
});
}).addValue('forestUrl', process.env.FOREST_URL || 'https://api.forestadmin.com');
};

here didn't get proccess.env.APPLICATION_URL and other variable values

  • Package Version: "forest-express-mongoose": "^8.6.3", "@forestadmin/agent": "^1.8.4", "@forestadmin/datasource-mongoose": "^1.3.2",
  • Express Version: "@feathersjs/express": "^4.5.12",
    Screenshot from 2023-04-13 16-29-25

Screenshot from 2023-03-20 12-16-25

Thanks for your report, we had an issue.

It has been fixed with #1005 🥇