Smart Action displaying flash error message though the Action worked fine

Expected behavior

I created a ‘bulk’ Smart Action named mark_as_sent_to_production on my model Contract. On Forest interface, I want to select one or several Contracts and mark them as sent_to_production, which is one option for the status attribute.

Actual behavior

The Smart Action actually works fine :

  • I can select one or several Contracts
  • It changes the statuses of those Contracts and mark them as sent_to_production
  • It reloads the page and displays the new statuses on the table

The problem comes from the fact that the interface displays a flash error message, though it worked fine.
The action xx cannot be reached. Is your server running? Did you configure this Smart Action properly?

Failure Logs

In the logs, I see my request returned a 200 status :
Completed 200 OK in 46ms (Views: 0.2ms | ActiveRecord: 24.9ms)
Just before starting other requests for displaying the table : Started OPTIONS "/forest/Contract?fields...

Context

I am using forest_liana:5.1 for Rails
The issue is found on development and production environments

Thank you very much for your help

Hi @juliepierre,
Welcome to the Forest Community :evergreen_tree::evergreen_tree::evergreen_tree:

Looks like you recently upgraded to the liana gem v5.
Did you read and apply the following recommandations in the “Upgrade to v5” note?

If the issue persists, it would be very helpful to identify which request generated this error message.
You can try to find it using you browser console opened on the network tab.

Thanks for you help!

Dear @arnaud,

Thank you very much for your answer.
Indeed, I had not followed the recommandations you mention and I apologize for that. So I just did and the issue persists.

In the console, I can see that the error comes from the request (in development) http://localhost:3000/forest/actions/passer-en-statut-sent-to-production
and more precisely, the issue is : Access to XMLHttpRequest at 'http://localhost:3000/forest/actions/passer-en-statut-sent-to-production' from origin 'http://app.forestadmin.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I now understand the problem, do you know how I can fix this ?

Thanks !

Ok, if this is your first Smart Action implementation, you might need to follow this documentation:
https://docs.forestadmin.com/documentation/v/inapp/how-tos/configuring-the-cors-headers

Once done, I think you’ll be all set… and the next Smart Action implementation will be a real pleasure :smiley:

1 Like

:ok_hand:
This is exactly what I was missing. I don’t know how it’s possible but I never came across this page, I probably did not search the right things.

Thank you very much ! It works fine now :pray:

2 Likes