Odd trouble with API calls

Your software
My Mautic version is: v4.1.2
My PHP version is: 7.4.30
My Database type and version is: Mysql 8.0.30

Your problem

I have trouble connecting to the Mautic API. I’m no expert in API / http requests, but I can navigate my way around n8n to produce fruitful results. Correctly setting up oauth2 authorization with token requests and all that is currently outside the scope of my understanding. So that’s where I’m at.

:white_check_mark: Currently I can set up a Mautic node in n8n (automation platform like Zapier, Integromat/Make) but that is limited in options… The credentials are correct and the system accepts the connection. These types of calls work: Get/Update Contact, Send segment email… But creating an email, and everything else within the scope of Mautic API is unavailable through the limitations of the node functions. So then a http request is my only option for that, which I cannot get to work.

:x: I tried to create a generic http request using “Credential type” for Mautic API, which is a simple log in for a unique User I created in Mautic strictly for the API access. The connection through the n8n system is accepted, showing a good connection. However, running a GET contacts/[ID] request returns:

{
"status": "rejected",
"reason": {
"context": {
},
"name": "NodeApiError",
"cause": {
"message": "connect ECONNREFUSED 127.0.0.1:80",
"name": "Error",
"stack": "Error: connect ECONNREFUSED 127.0.0.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)",
"code": "ECONNREFUSED"
},
"timestamp": 1664205087653,
"message": "UNKNOWN ERROR - check the detailed error for more information",
"node": {
"parameters": {...}, // 10 keys
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [...], // 2 items
"credentials": {...} // 2 keys
},
"httpCode": "ECONNREFUSED",
"description": "connect ECONNREFUSED 127.0.0.1:80"
}
} 

:x: If I instead go with the “Credential type” Mautic Oauth2 API, once again the connection is accepted, but the GET contacts/[ID] call, returns exactly the same “ECONNREFUSED” error response. This means I cannot use all the wonderful capability of Mautic’s API like creating/editing emails, forms, landing pages, etc.

It is absolutely possible I do not have the Oauth2 settings correctly configured - maybe that’s a simple fix?

I’ve been having trouble with this for some time, and I’ve scoured YouTube, I’ve read through the Mautic docs and I’m here now because I can’t figure this out myself. If anyone has some wise council, I would really appreciate this!

Steps I have tried to fix the problem:

  • Scoured Mautic REST API docs
  • Watched YouTube vids
  • Read through related forum topics on Mautic, n8n, github, stackoverflow and other broader forums
  • Exhausted all ideas I can come up with myself

Thanks!

EP

1 Like

I’m using n8n with basic auth - and it works for me really well. Can’t say anything about basic auth.

1 Like

Ah, update:

Now none of the connections are working at all with API. I don’t even know what changed since I posted this…but nothing is working, not even the reliable connection in Integromat - even that one now gives me 500 server error, with no connection.

Eh. This is super frustrating.

1 Like

Thanks Joey, I’m not understanding exactly what you mean.

Is “Basic auth” the credentials-only connection? As in, not the “Oauth2” connection?

If so, that is the only one I have gotten to work within n8n, but also it only works with the Mautic node. That same connection was not working with an http request node.

But, as in my above comment, now nothing is working. 100% of my automation connections to Mautic are not functional at the moment. I’m running into more problems with Mautic these days than I am finding solutions…

1 Like

This is my error now - even on existing automations that worked yesterday.

{
"context": {
},
"name": "NodeApiError",
"cause": {
"message": "500 - {"errors":[{"message":"Looks like I encountered an error (error #500). If I do it again, please report me to the system administrator!","code":500,"type":null}]}",
"name": "Error",
"stack": "Error: Request failed with status code 500 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:539:35) at IncomingMessage.emit (node:domain:475:12) at endReadableNT (node:internal/streams/readable:1345:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)"
},
"timestamp": 1664208223646,
"message": "The service was not able to process your request",
"node": {
"parameters": {
"authentication": "credentials",
"resource": "contact",
"operation": "update",
"contactId": "={{ $json["query"]["ContactID"] }}",
"jsonParameters": true,
"updateFields": {...}, // 1 keys
"options": {...} // 1 keys
},
"name": "Mautic",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
1040,
480
],
"credentials": {
"mauticApi": {...} // 2 keys
}
},
"httpCode": "500",
"description": "Looks like I encountered an error (error #500). If I do it again, please report me to the system administrator!"
} 

What does mautic log says in /var/logs says, any details there?

1 Like

This is from yesterday, 25 Sept:

[2022-09-25 19:48:07] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/mautic/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":605000} []

This is from today:

[2022-09-25 20:55:55] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/catalogue.en_US.ijbxPY_.phpLSWAg3" to "/var/www/html/mautic/var/cache/prod/translations/catalogue.en_US.ijbxPY_.php". - in file /var/www/html/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2022-09-25 21:30:08] mautic.WARNING: PHP Warning - unlink(/var/www/html/mautic/app/../var/cache/prod/translations/catalogue.en_US.ijbxPY_.php): Permission denied - in file /var/www/html/mautic/plugins/GautitClearCacheBundle/Controller/DefaultController.php - at line 66 {"dir":"/var/www/html/mautic/app/../var/cache/prod/translations","objects":[".","..","catalogue.en_US.ijbxPY_.php","catalogue.en_US.ijbxPY_.php.meta"],"object":"catalogue.en_US.ijbxPY_.php"} []
[2022-09-25 21:30:08] mautic.WARNING: PHP Warning - unlink(/var/www/html/mautic/app/../var/cache/prod/translations/catalogue.en_US.ijbxPY_.php.meta): Permission denied - in file /var/www/html/mautic/plugins/GautitClearCacheBundle/Controller/DefaultController.php - at line 66 {"dir":"/var/www/html/mautic/app/../var/cache/prod/translations","objects":[".","..","catalogue.en_US.ijbxPY_.php","catalogue.en_US.ijbxPY_.php.meta"],"object":"catalogue.en_US.ijbxPY_.php.meta"} []
[2022-09-25 21:30:08] mautic.WARNING: PHP Warning - rmdir(/var/www/html/mautic/app/../var/cache/prod/translations): Directory not empty - in file /var/www/html/mautic/plugins/GautitClearCacheBundle/Controller/DefaultController.php - at line 70 {"dir":"/var/www/html/mautic/app/../var/cache/prod/translations","objects":[".","..","catalogue.en_US.ijbxPY_.php","catalogue.en_US.ijbxPY_.php.meta"],"object":"catalogue.en_US.ijbxPY_.php.meta"} []
[2022-09-25 21:30:08] mautic.WARNING: PHP Warning - rmdir(/var/www/html/mautic/app/../var/cache/prod): Directory not empty - in file /var/www/html/mautic/plugins/GautitClearCacheBundle/Controller/DefaultController.php - at line 70 {"dir":"/var/www/html/mautic/app/../var/cache/prod","objects":[".","..","ContainerYFaTBDP","UrlGenerator.php","UrlGenerator.php.meta","UrlMatcher.php","UrlMatcher.php.meta","annotations.map","appAppKernelProdContainer.php","appAppKernelProdContainer.php.lock","appAppKernelProdContainer.php.meta","appAppKernelProdContainer.preload.php","data","doctrine","jms_serializer","middlewares.cache.php","pools","translations"],"object":"translations"} []
[2022-09-26 01:50:32] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 01:50:33] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:13:19] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:39:28] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:39:29] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:39:58] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:39:59] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:42:36] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:42:37] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:42:56] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:42:56] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:43:08] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:43:09] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:43:44] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:43:45] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:43:53] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:43:53] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:44:46] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:44:47] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:45:36] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:45:36] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:45:46] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:45:47] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:46:43] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:46:44] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:51:07] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:51:08] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:51:28] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:51:29] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:52:28] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 02:52:29] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 13:10:23] mautic.NOTICE: PHP Notice - Trying to access array offset on value of type bool - in file /var/www/html/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {"request":"[object] (Symfony\\Component\\HttpFoundation\\Request: GET ///ext-js/app/common/zyFunction.js?v=220104164712 HTTP/1.1\r\nAccept:          */*\r\nAccept-Encoding: gzip, deflate\r\nConnection:      keep-alive\r\nHost:            104.237.2.228\r\nUser-Agent:      python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-1160.76.1.el7.x86_64\r\nX-Php-Ob-Level:  1\r\n\r\n)","exception":"[object] (Symfony\\Component\\Debug\\Exception\\FlattenException: {})","logger":null,"class":"Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException","currentContent":"","layout":"Error","code":404,"anonymous":true,"baseTemplate":"MauticCoreBundle:Default:slim.html.php","templatePage":false,"template":"MauticCoreBundle:Error:404.html.php","templating":"[object] (Symfony\\Bundle\\FrameworkBundle\\Templating\\DelegatingEngine: {})","statusText":"Not Found","url":"///ext-js/app/common/zyFunction.js?v=220104164712","urlParts":false} []
[2022-09-26 14:57:50] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 14:57:50] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:45:47] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:46:03] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:46:24] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:46:35] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:54:29] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:54:37] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:54:40] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:54:54] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 15:55:09] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 16:03:42] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []
[2022-09-26 16:03:43] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/html/mautic/var/cache/prod/jms_serializer" is not writable." at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php line 48 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/html/mautic/var/cache/prod/jms_serializer\" is not writable. at /var/www/html/mautic/vendor/jms/metadata/src/Cache/FileCache.php:48)"} []

Hi,

based on error you have posted I believe the issue is in permissions. Every time you deploy something/clear the cache or manipulate mautic files on the server you should run the permissions script I have given you otherwise you might experience difficulties with mautic.

So var/cache and everything in it must be writable by web server user (usually www-data).

Please give another test to the integration and see if it works.

Hope it helps.
Regards, M.

1 Like

WORKS!!! @mzagmajster you are a wizard.

I need to figure out how to run that script. I guess it’s at the command line.

1 Like

Yes, you use terminal.

You login to your server with:

ssh <user>@<ip>
<path-to-script>

Press enter and you are done.

1 Like

Hi!
I’ve the same problem, but I can’t figure out a solution. Every time I clear cache, the oAuth works only once :frowning: Then, it goes back to error 500, both on n8n and Zapier.
Can you help me?
Thanks a lot.

“The directory “/home/…/public_html/…/…/var/cache/prod/jms_serializer” is not writable.”

1 Like

Hi, what if you make it writable? :slight_smile:

1 Like

File/directory permissions are extremely important for Mautic functionality (and for security, on the other side). But as I’ve come to realize, different Mautic installs can result in different file permission settings. How/why that happens is simply beyond my current understanding. I just know it’s critical they are set correctly.

EP

Hi @joeyk! of course, I’ve tried to do that :smiley:

I’ve also tried to completely delete cache folder to force mautic to rebuild cache folder again; and so on…

But, today something come to my mind, and I’ve tried to delete “tmp” folder (since I had a similar problem related with “unsubscribing” not working, and the problem was in “tmp” folder), and guess what… everything is working normal now… API connecting with Zapier / N8N :rofl:

The log was referring permissions in cache folder, but probably it was nothing to do with that… :slight_smile:

Well, strange thinks appends to strange people!

I hope it will help somebody with the same issue…

1 Like

Hi, In my opinion the best way to clear cache is via command:

php /var/www/html/mautic/bin/console cache:clear

Or if you are sudo, and the webserver owner is www-data, then:
sudo -u www-data php /var/www/html/mautic/bin/console cache:clear

Where can I find this permissions script please? Thank you.

yes @mzagmajster I too am looking for the permissions script
(also running into permissions errors that are causing issues with API)

Drop me a DM, please

1 Like

@mzagmajster :point_left: this guy is a genius, trust him.

1 Like