# 500 errors with Sparkpost webhook

**URL:** <https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302>\
**Category:** Product Support\
**Created:** [March 9, 2020, 2:16pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302 "2020-03-09T14:16:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rehansaleem](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rehansaleem/32/398_2.png) [@rehansaleem](https://forum.mautic.org/u/rehansaleem)\
**Post date:** [March 9, 2020, 2:16pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/1 "2020-03-09T14:16:06Z")

</div>

Mautic version 2.16  
PHP version 7.1

> [@](#):
>
> [**View in #general on Slack**](https://slack.com/archives/C02GEN0SG/p1583763160081100)
> 
> ![RS](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/5690b9e0a48c1e867d751a8dc7da0bc5738fe1a4.png) **@RS:** Hello Everyone, i have installed Mautic 2.16 on CentOS 7 with PHP 7.1, I have added sparkpost API’s in the email setting and test emails are going out fine, but when i try to configure webhook in sparkpost i get 500 error message, could you please identify what could be the reason behind this.  
> here are my apache error logs.  
> `PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/app/logs/mautic_prod-2020-03-09.php" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler-&gt;write(Array)\n#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler-&gt;write(Array)\n#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler-&gt;handle(Array)\n#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(644): Monolog\\Logger-&gt;addRecord(500, 'Uncaught PHP Ex...', Array)\n#4 /var/www/html/vendor/symfony/http-kernel/EventListener/ExceptionListener.php(102): Monolog\\Logger-&gt;critical('Uncaught PHP Ex...', Array)\n#5 /var/www/html/app/bundles/CoreBundle/EventListener/ExceptionListener.php(74): Symfon in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107`  
> `PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/app/logs/mautic_prod-2020-03-09.php" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler-&gt;write(Array)\n#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler-&gt;write(Array)\n#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler-&gt;handle(Array)\n#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(518): Monolog\\Logger-&gt;addRecord(400, 'PHP Error: Unca...', Array)\n#4 /var/www/html/app/bundles/CoreBundle/ErrorHandler/ErrorHandler.php(427): Monolog\\Logger-&gt;log(400, 'PHP Error: Unca...', Array)\n#5 /var/www/html/app/bundles/CoreBundle/ErrorHandler/ErrorHandler.php(245): Mautic\\CoreBundle\\Err in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107`

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [March 9, 2020, 3:26pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/2 "2020-03-09T15:26:14Z")

</div>

Hi there,

> /var/www/html/app/logs/mautic\_prod-2020-03-09.php" could not be opened: failed to open stream: Permission denied

This might seem to indicate that there are some file/folder ownership/permissions problems with your Mautic instance.

Do you see any warnings under Settings Cog \> System Info \> Folder & File permissions?

---

<div class="post-metadata">

**Author:** ![rehansaleem](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rehansaleem/32/398_2.png) [@rehansaleem](https://forum.mautic.org/u/rehansaleem)\
**Post date:** [March 9, 2020, 3:31pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/3 "2020-03-09T15:31:01Z")

</div>

Yes, i noticed that too, it seems to be a permission problem, all files and folders are owned by apache user on my instance and i don’t see any file permission error in backed.

Settings Cog \> System Info \> Folder & File permissions?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [March 9, 2020, 3:39pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/4 "2020-03-09T15:39:08Z")

</div>

Sorry here’s what I meant in a quick screen capture in case that didn’t make sense:

Sometimes you can get issues with ownership/permissions and the folder/file permissions view may well flag those up for you.

---

<div class="post-metadata">

**Author:** ![rehansaleem](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rehansaleem/32/398_2.png) [@rehansaleem](https://forum.mautic.org/u/rehansaleem)\
**Post date:** [March 9, 2020, 3:43pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/5 "2020-03-09T15:43:21Z")

</div>

Thanks for screen capture, here is the screenshot of the backend configuration.

 ![Firefox_Screenshot_2020-03-09T15-41-17.709Z](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/b/b48da6914eec35481717696696abfd724bc1457c.png)

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [March 9, 2020, 3:59pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/6 "2020-03-09T15:59:46Z")

</div>

Do you have command-line access? If so, can you provide a screenshot of your file/folders by executing the following command within your /var/www/html directory?

```
ls -l

```

It might not be permissions/ownership related but worth checking before going down any tangents 🙂

Also did you experience these (or any other) errors at any point before you set up your Sparkpost integration at all?

---

<div class="post-metadata">

**Author:** ![rehansaleem](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rehansaleem/32/398_2.png) [@rehansaleem](https://forum.mautic.org/u/rehansaleem)\
**Post date:** [March 9, 2020, 4:03pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/7 "2020-03-09T16:03:24Z")

</div>

Here is the screenshot of above command.

![permisson](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/55740d8ad84abe8ef54f5c5602e35e6352feb0a0.png)

---

<div class="post-metadata">

**Author:** ![autoize](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/autoize/32/105_2.png) [@autoize](https://forum.mautic.org/u/autoize)\
**Post date:** [March 9, 2020, 5:20pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/8 "2020-03-09T17:20:37Z")

</div>

Do you only get the 500 error when you try accessing the SparkPost callback URL directly?  
Or, is it when you are setting up the bounce notification in the SparkPost dashboard?

The callback URL is not really designed to be accessed directly in a browser. Its only intended to receive POST requests from the email service itself with a JSON payload - indicating bounce (hard bounce, soft bounce) or complaint.

The way the bounce notification for each transport is implemented in Mautic is slightly different. For example, the Amazon SES callback URL triggers a 500 error if its accessed through the browser. Whereas the Sendgrid callback URL displays a page showing “success” if accessed through the browser. In both cases however, the bounce notification does work.

The 500 error can be a bit of a false alarm. OP, can you try sending a message to a non-existent email address and see if it is marked as **Email Bounced** inside the contact record within Mautic? That is the definitive way to see if bounce tracking for your selected transport is working.

---

<div class="post-metadata">

**Author:** ![rehansaleem](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rehansaleem/32/398_2.png) [@rehansaleem](https://forum.mautic.org/u/rehansaleem)\
**Post date:** [March 9, 2020, 5:25pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/9 "2020-03-09T17:25:09Z")

</div>

Yes, I’m not accessing callback url in browser, trying to create webhook inside Sparkpost as described in the following url.

[https://www.mautic.org/docs/en/emails/bounce\_management.html](https://www.mautic.org/docs/en/emails/bounce_management.html)

---

<div class="post-metadata">

**Author:** ![rehansaleem](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rehansaleem/32/398_2.png) [@rehansaleem](https://forum.mautic.org/u/rehansaleem)\
**Post date:** [March 12, 2020, 8:49pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/10 "2020-03-12T20:49:18Z")

</div>

I have installed Mautic 2.15.2 with same environment and configuration steps, everything working perfectly fine.

---

<div class="post-metadata">

**Author:** ![ericgr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ericgr/32/5505_2.png) [@ericgr](https://forum.mautic.org/u/ericgr)\
**Post date:** [June 18, 2020, 9:59pm UTC](https://forum.mautic.org/t/500-errors-with-sparkpost-webhook/13302/11 "2020-06-18T21:59:51Z")

</div>

For any future readers:

I ran into this problem after I modified a few files in Mautic - nothing big, just some css and a few lines of html, cleared the cache and BOOM. site down.

After reading @silavapi’s post above, I just reran the permissions for the hell of it:

Chown -R www-data:www-data /var/www/html  
Chmod -R 775 /var/www/html

Restarted apache (service apaches2 restart) and then magically everything worked again.
