Your software
My Mautic version is: 5.2.1
My PHP version is: 8.2
My Database type and version is: MariaDB 11.4.4, client 15.2 for debian-linux-gnu
Your problem
My problem is: API Erroring 500 when data exists.
I recently fresh installed mautic and setup with 1 plugin:
I enabled API and HTTP Basic Auth. I use the npm library by vdavid:
Although the library has not been updated in a while, I’ve inspected it and it looks like it should still work. And it does seem to be.
I added contacts and had sent segment emails successfully already. The contact API was returning an error 500:
Errors: 500: Looks like I encountered an error (error #500). If I do it again, please report me to the system administrator!
I had zero Campaigns created. After trialing the GET /campaigns API call - it returned successfully with no error correctly displaying zero campaigns.
{ total: 0, campaigns: }
Then I created a campaign, ran the API again, and it returned the same 500 error mentioned above. I deleted the campaign and it successfully returned zero campaigns.
I looked at the log files and found no related error log, only an access log entry.
WARNING! You are about to execute a migration in database “mautic” that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
yes
[notice] Migrating up to Mautic\Migrations\Versionzz20230929183000
[notice] Migration Mautic\Migrations\Version20190326190241 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20190410143658 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Schema includes this migration
[notice] Migration Mautic\Migrations\Version20190524124819 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20200415135706 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20200513162918 skipped during Pre-Checks. Reason: “The body_text column has already been added to the mauticemail_copies table.”
[notice] Migration Mautic\Migrations\Version20200917152259 skipped during Pre-Checks. Reason: “default_value is already the correct type.”
[notice] Migration Mautic\Migrations\Version20201019100000 skipped during Pre-Checks. Reason: “Table mauticemails_draft already exists. Skipping migration”
[notice] Migration Mautic\Migrations\Version20201026101117 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20210112162046 skipped during Pre-Checks. Reason: “Index integration_integration_object_name_last_sync_date already exists. Skipping the migration”
[notice] Migration Mautic\Migrations\Version20210115065034 skipped during Pre-Checks. Reason: “The emails table already includes the preheader_text column”
[notice] Migration Mautic\Migrations\Version20210217115150 skipped during Pre-Checks. Reason: “Deleted column already added in tables”
[notice] Index mauticlead_list_alias already exists
[notice] Migration Mautic\Migrations\Version20210420113309 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Index mauticidx_object_field_order_is_published already exists
[notice] Migration Mautic\Migrations\Version20211026152443 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Index mauticidx_frequency_date_added already exists
[notice] Migration Mautic\Migrations\Version20211026153057 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Column already in BOOLEAN type
[notice] Migration Mautic\Migrations\Version20211110070503 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Table mauticcontact_export_scheduler already exists
[notice] Migration Mautic\Migrations\Version20220429091934 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20220722074516 skipped during Pre-Checks. Reason: “The deduplicate column has already been added to the mauticnotifications table.”
[notice] Migration Mautic\Migrations\Version20221014061125 skipped during Pre-Checks. Reason: “Index mauticwebhook_id_date_added already exists”
[notice] Migration Mautic\Migrations\Version20221014081742 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20221128145933 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20230131133732 skipped during Pre-Checks. Reason: “The last_built_time column has already been added to the mauticlead_lists table.”
[notice] Column mauticasset_downloads.utm_campaign already exists
[notice] Column mauticasset_downloads.utm_content already exists
[notice] Column mauticasset_downloads.utm_medium already exists
[notice] Column mauticasset_downloads.utm_source already exists
[notice] Column mauticasset_downloads.utm_term already exists
[notice] Migration Mautic\Migrations\Version20230321133733 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration Mautic\Migrations\Version20230424083829 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] The index “mauticdnc_date_added” has already been added to the table “mauticlead_donotcontact”.
[notice] Migration Mautic\Migrations\Version20230506112314 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] The index “mauticstat_dynamic_content_date_sent” has already been added to the table “mauticdynamic_content_stats”.
[notice] Migration Mautic\Migrations\Version20230506113422 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] The index “mauticmessage_queue_date_published” has already been added to the table “mauticmessage_queue”.
[notice] Migration Mautic\Migrations\Version20230506113627 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] The index “mauticlead_stages_change_log_date_added” has already been added to the table “mauticlead_stages_change_log”.
[notice] Migration Mautic\Migrations\Version20230506113731 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] The index “mauticutm_date_added” has already been added to the table “mauticlead_utmtags”.
[notice] Migration Mautic\Migrations\Version20230506113812 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Table mauticplugin_crm_pipedrive_owners was already removed
[notice] Migration Mautic\Migrations\Version20230519154448 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Migration is not required.
[notice] Migration Mautic\Migrations\Version20230606111852 skipped during Pre-Checks. Reason: “Schema includes this migration”
[notice] Table mauticpoint_groups already exists
[notice] Table mauticpoint_group_contact_score already exists
[notice] Column mauticpoints.group_id already exists
[notice] Column mauticpoint_triggers.group_id already exists
[notice] Column mauticlead_points_change_log.group_id already exists
[error] Migration Mautic\Migrations\Version20230621074925 failed during Execution. Error: “An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mauticpoint_groups’ already exists”
In ExceptionConverter.php line 45:
An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mauticpoint_groups’ already exists
In Exception.php line 28:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mauticpoint_groups’ already exists
In Connection.php line 71:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘mauticpoint_groups’ already exists
We don’t believe VisionovaDev’s issue is related. Their issue was not being able to send emails, because their Amazon SES transport was missing. However, your issue is similar to alexhammerschmied’s issue in the original topic. To confirm the issue is in fact a problem with Mautic and not the Node.js API wrapper, can you try a couple troubleshooting steps: