Skip to content

API Returning 500 error on successful call #294

Open
@ShareBtech

Description

@ShareBtech

Mautic Version

4.2.x series

PHP version

7.4

What browsers are you seeing the problem on?

No response

What happened?

After having installed on 4.4.5 seamlessly I am trying to run some API calls and I see that the actual call is executing the desired result, however I am getting a 500 error back in response:

This is the error I am seeing:

2022/12/19 12:45:07 [error] 47597#47597: *10668 FastCGI sent in stderr: "PHP message: PHP Warning: get_class() expects parameter 1 to be object, int given in /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Base.php on line 73" while reading response header from upstream, client: 199.99.99.99, server: mymauitc.com, request: "PATCH /api/contacts/13/edit?includeCustomObjects=true HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "mymauitc.com"
And in the access log:

138.68.137.203 - apiuser [19/Dec/2022:12:45:07 +0000] "PATCH /api/contacts/13/edit?includeCustomObjects=true HTTP/1.1" 500 172 "-" "axios/0.21.4"
And my object looks like this:

{ "customObjects": { "data": [{ "id": 1,"alias": "deposits", "data": [{ "id":"8", "name": "Deposit-DateInputHere", "attributes": { "deposit-date1": "2022/12/29", "deposit-currency": "USD" ,"deposit-amount":"9000", "deposit-brand":"Surge"}}]}] } }
But like I say the object is actually created correctly inside Mautic.

Any ideas ?

Added Test: Set up the exact same custom object and fields in 4.4.5 and ran the same API call and I am getting the 500 error, whereas on 4.4.4 it returns a success.

How can we reproduce this issue?

Step 1:

Relevant log output

2022/12/19 12:45:07 [error] 47597#47597: *10668 FastCGI sent in stderr: "PHP message: PHP Warning:  get_class() expects parameter 1 to be object, int given in /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Base.php on line 73" while reading response header from upstream, client: 199.99.99.99, server: mymauitc.com, request: "PATCH /api/contacts/13/edit?includeCustomObjects=true HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "mymauitc.com"

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions