Hello,
I’m trying to use the load hook for a smart action called upload-assets. At the moment I’m just trying to log what is in the context object and returning the fields back like the docs suggest:
The problem is that as soon as I open the smart action from Forest Admin’s UI I see it trying to call two different endpoints:
/forest/actions/upload-assets/values
/forest/actions/upload-assets/hooks/load
and because they don’t exist I get a 404 (The route called on form load is not reachable) from express and the smart action doesn’t work (the load function is never called). I didn’t find in the docs anythining mentioning that I should implement these two endpoints. The only suggestion is the one to handle the smart action that I already have in place: /actions/upload-assets.
I’m kinda lost here and couldn’t find any direction in the docs or any issues mentioning this error. Could you please point me in any direction here?
Hi @nathanqueija and welcome to the ForestAdmin community,
I just tested the load hook on my end and it seems to work properly. There might be a bad configuration in the all smart action, could you please share the all action definition please?
For your concerns those two routes are called to prefill smart action fields with default values:
The /forest/actions/upload-assets/values is used to provide static default values and is not defined on your end, leading to a 404 error which is normal behavior here.
On the other hand, /forest/actions/upload-assets/hooks/load is used to provide dynamic default values and it looks properly defined on your end.
With the exact same smart action definition as yours and being on the exact same forest-express-sequelize version as yours, my load hook gets called properly.
Is the /forest/actions/upload-assets/hooks/load call still returning a 404 response? If so, could you try to stop and restart your API?
@anon37102731 already did. Three times and the error persists. I can only see the data in the table view (with all the previous fields settings missing), but can’t see the details view.