Possible bug with Mautic node - update contact (or I am making a mistake?)

I use the mautic node a lot but today is the 1st time I am using the node to update a particular contact by contact ID. I am simply fetching data from a google sheet that includes the Mautic contact ID. Then wanting to update the contact by looking for the contactID and then inserting the custom field value from the Google sheet.

When I run the node I get an error
“Requested URL not found: /api/contacts//edit”
It seems to me there should not be 2 “//” in the url?

Share the output returned by the last node

Information on your n8n setup

  • n8n version: - 0.219.1
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: - own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: - Docker

Mautic API docs seems to suggest to update the contact one needs to use the end point

/contacts/ID/edit

So the url is correct I think as the ID should be inserted between the 2 “//”
However the ID is not being inserted perhaps?

https://developer.mautic.org/#edit-contact

I am able to retrieve the mautic data of the contact using the same data ID so it seems just the “update” operation in the Mautic node may have a bug.

On further testing it seems any attempt to apply an action to a specific contact ID fails.

  • send an email
  • update points
  • update
1 Like

Further update, seems the contact was updated in Mautic despite n8n throwing an error message. All requested actions were taken

  • custom field updated
  • points added
  • email sent
    But each time n8n reports that it did not work and gives the error…

Hi @Robm, I am sorry you’re having trouble. I just gave this a go on my own instance and didn’t run into any trouble with updating Mautic contacts:

Is there a chance the data coming from your Google Sheet can be incomplete? As in one (or more) items from your Google Sheet node (and the subsequent Set node) not coming with a valid Contact ID?

Thanks @MutedJam

To test that I added another Mautic node and retrieved the data using the same contactID and that worked so I assume then the contactID is correct.

Also despite the error being returned by n8n, that mautic action actually takes place. In this case the custom field for the right contact is updated in Mautic.

Is this perhaps related to your specific field? Do you also see the error when updating a standard field instead?

And are you able to narrow this down further to specific items? How many items are coming in from your Google Sheets node and do you also encounter this error when (for example) limiting this workflow to just the first 10 items?

I am using just 3 records for now for testing. Errors are thrown for all 3 records for an action that requires updating the record.

  • send an email
  • update points
  • update
    But the action still happens.

I have just tested with a std field and get the same error (pasted below) but the field is updated in Mautic.

If I request data then that works 100% fine without error.
I have tried accessing the mautic via basic auth and via Oauth 2 to see if that could be an issue but same result.

I am able to update or create records successfully with no error if I ID the record via email rather than the contactID. But in this case using the email address is not an option.

ERROR: UNKNOWN ERROR - check the detailed error for more information

Requested URL not found: /api/contacts//edit

Details

Time

28/03/2023, 12:34:19

Stack

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.mauticApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Mautic/GenericFunctions.js:37:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Mautic/Mautic.node.js:625:40)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:658:28)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:590:53

Hm, tbh I am a bit lost here seeing this is working fine for me using a brand new Mautic demo instance. Can you confirm how exactly you have set up your Mautic instance so I can try and re-create your specific environment?

Its on a VPS from digital ocean, linux and Nginx. Its a hard working mautic instance that has been around a long time and works well. I have it connected to lots of tools via n8n all working well.

It’s not the very latest version as I wait for bugs to be worked out before updating but it is very recent version.

I am not great with CLI and linux, just the very basics.

Thanks for all your help so far, n8n has a great supportive forum.

1 Like

Found the issue.

I had data coming in from a google sheet that had empty rows. I was using a set node but passing all the data through so the Mautic node was trying to process incomplete data and that was causing the error. That also explains why the data was being updated in Mautic as the error was related to the incomplete data sets rather than the complete ones.

I added an IF node to filter out the empty data sets and everything worked.

Thanks to @Surge.Media , a fellow Mautic user, for working through this with me.

Also thanks to @MutedJam who was kind enough to offer to get on a call with me to assist.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.