Workflow Calling Moodle API Fails in Production but Works in Staging

Hi everyone,

I’m encountering an issue with a workflow that makes a REST API call to Moodle to create a new category. The call (moodle_create_category) was previously working fine in production, but now it only succeeds in staging mode when I run directly within the workflow. In production mode, it throws an invalid_parameter_exception error from Moodle with the message “Invalid parameter value detected.”

I’ve been breaking my head trying to understand why this is happening, but no luck so far. If anyone has run into a similar issue where a call works in staging but fails with parameter errors in production, I’d really appreciate any guidance or suggestions!

In production:


In staging:


Update:

After more troubleshooting, it seems the issue may actually be within Retool's query UI. I’m now experiencing the same invalid_parameter_exception error across all my API queries within the Retool query setup.

As a test, I tried replicating the API call using axios directly in a JS query, and it worked without any issues. This seems to indicate that something specific to the Retool query UI is causing the parameter validation problem, rather than the API call or Moodle itself.

Hi @alex2222 that's weird. Could you please console.log the const turma in order to see what's comming from the startTrigger in both environments. Could you share the moodle resource both for staging and production environments?

@Almopt thanks for replying.

I figured it out, the url param had Content-Type set to application/json in the Moodle Resource in the Resources page, which how it was setup and working previously, so I try without it and worked

@alex2222 I'm glad you managed to solve it.