Unexpected error after running Smart Action but all is fine

Hello Forest,
I added a Smart Action to my Rails app. However, even if the code is running just fine, it displays the following error in the dashboard:

Unexpected error with Generate Audio Url action.

Here is my code:

def generate_audio_url
		quiz_question_id = ForestLiana::ResourcesGetter.get_ids_from_request(params).first
		quiz_question = QuizQuestion.find(quiz_question_id)
		if quiz_question.present?
			if quiz_question.question_type == "dictation"
				DicteesWorker::CreateAudioSampleWorker.perform_async(nil, quiz_question.id)
			end
		end

		render json: { success: 'Nous créons le fichier audio…' }
	end

I guess that’s something related to render json? What should I render so everything looks fine in the Forest Admin panel?

Thanks.

Hello @nico_lrx :wave:

Do you have any error in the browser’s console ? Can you share screenshots of the request’s payload and response (in Chrome: Developer tools > Network > the request sent when you trigger the Smart Action > Payload and Preview) ?

Hello @NicolasGriselle,
Thanks for your help. Apparently there is a CORS error. Maybe it’s related to Cloudflare?

Here are the screenshots :




Thanks!

Thank you.

You need to configure the CORS headers.

Let me know if it works.

Génial, ça fonctionne, merci !