Trying to access the request headers from the context or other means. Currently cannot find it.
Expected behavior
Access information like the ip address of the request being made.
Context
Hey, I’m currently in the process of migrating form the old forest-express-sequelize agent to the @forestadmin/agent agent. I see that the new agent abstracted the request object that was previously passed to smart actions with context.caller. Is there any way to access the request object? I’m mostly interested in the ip address.
Agent technology: NodeJS
Agent (forest package) name & version: @forestadmin/agent: 1.47.0
Recent changes made on your end if any: Migration from old express-sequelize agent to new node agent.
Indeed, currently it is not possible to access request headers through the agent context.
Could you tell me more precisely what is your usecase for using the ip address ?
We pass it along to one of our endpoint where it eventually gets logged.
The endpoint is used for syncing connections which happens automatically but this smart action is used to trigger a manual sync if there were any problems syncing automatically. The current implementation does require an ip address so we were hoping that we could also pass the ip address from forest admin as well.
I understand that it would not be exactly the same implementation than before, but is it possible to always provide the agent ip (or any identifiable constant value) when syncing from the action, and then you can rely on activity logs to know who has executed the action if needed ?
Yes indeed ! We’ve just released this If you update your agent to the v1.51.0, you’ll be able to get the requester IP from the action context: context.caller.request.ip !