ForgeRock / node-openam-agent

OpenAM Policy Agent for Node.js / Express
MIT License
13 stars 12 forks source link

Policy Shield Evaluation Error #50

Closed zkhalid123 closed 2 years ago

zkhalid123 commented 3 years ago

Hi I am facing an issue with Policy Shield. OpenAM server is up and running I have configured the agent there. But when I load the Node App, instead of redirecting me to OpenAM authentication page I see the following error image

In node logs I get [k6Os0Jgip] PolicyAgent#shield: evaluation error (%s) I cannot figure out what the issue could be, can you please guide me.

Regards

zoltantarcsay commented 3 years ago

Hi,

you could find out more if you logged out the original error somewhere here: https://github.com/ForgeRock/node-openam-agent/blob/master/src/shield/cookie-shield.ts#L70

Actually the stack trace of the wrapped error should be included in the error template, but your screenshot looks nothing like it: https://github.com/ForgeRock/node-openam-agent/blob/master/src/templates/error.handlebars#L71

zkhalid123 commented 3 years ago

@zoltantarcsay actually we are using a custom template, a simple one to show the error, (status code, message and stack)

I am defining the agent like this

var agent = new openamAgent.PolicyAgent({ serverUrl: "https://example.com:8090/openam", appUrl: "https://example.com:443/", notificationRoute: '/', notificationsEnabled: true, username: 'agentname', password: "agentpass", realm: '/', appName: 'iPlanetAMWebAgentService', logLevel: "info", errorPage: ({ status, message, details }) => <html><body><h1>${status} - ${message} - </h1> <p> ${details}</p> </body></html>

});

I believe "detail" is the actual stack from the ShieldEvaluationError.

how can I get further details?

zoltantarcsay commented 3 years ago

I'm not sure what's causing this; you could try stepping through the code with a debugger or setting logLevel to debug or silly (or both)