Skip to content

[5.x]: afterSave Webhooks Error #97

@MWhiteFearless

Description

@MWhiteFearless

What happened?

Description

I'm in the process of upgrading my project from 4.x to 5.x. When trying to save an entry, I get this error related to the webhooks plugin (it's configured to run aftersave). I am running locally, and it seems to be caused by an unset environment variable used in the debounce and custom headers. Would it be possible to support missing env variables again? I would think that missing env variables should still allow the entry to save, and just the webhook might not work correctly.

Expected behavior

To be able to save entries without a webhooks error.

Actual behavior

2025-07-28 17:39:10 [web.ERROR] [TypeError] TypeError: craft\web\View::renderString(): Argument #1 ($template) must be of type string, null given, called in /usr/local/craftcms/vendor/craftcms/webhooks/src/Plugin.php on line 188 and defined in /usr/local/craftcms/vendor/craftcms/cms/src/web/View.php:646
Stack trace:
#0 /usr/local/craftcms/vendor/craftcms/webhooks/src/Plugin.php(188): craft\web\View->renderString(NULL, Array)
#1 [internal function]: craft\webhooks\Plugin->craft\webhooks\{closure}(Object(craft\events\ModelEvent))
#2 /usr/local/craftcms/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\events\ModelEvent))
#3 /usr/local/craftcms/vendor/yiisoft/yii2/base/Component.php(654): yii\base\Event::trigger('craft\\elements\\...', 'afterSave', Object(craft\events\ModelEvent))
#4 /usr/local/craftcms/vendor/craftcms/cms/src/base/Element.php(6413): yii\base\Component->trigger('afterSave', Object(craft\events\ModelEvent))
#5 /usr/local/craftcms/vendor/craftcms/cms/src/elements/Entry.php(2919): craft\base\Element->afterSave(false)
#6 /usr/local/craftcms/vendor/craftcms/cms/src/services/Elements.php(3962): craft\elements\Entry->afterSave(false)
#7 /usr/local/craftcms/vendor/craftcms/cms/src/services/Elements.php(1250): craft\services\Elements->craft\services\{closure}()
#8 /usr/local/craftcms/vendor/craftcms/cms/src/services/Elements.php(3744): craft\services\Elements->ensureBulkOp(Object(Closure))
#9 /usr/local/craftcms/vendor/craftcms/cms/src/services/Elements.php(1336): craft\services\Elements->_saveElementInternal(Object(craft\elements\Entry), true, false, NULL, Array, false, false, false)
#10 /usr/local/craftcms/vendor/craftcms/cms/src/controllers/ElementsController.php(1424): craft\services\Elements->saveElement(Object(craft\elements\Entry), true, true, NULL, false, false)
#11 [internal function]: craft\controllers\ElementsController->actionSave()
#12 /usr/local/craftcms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /usr/local/craftcms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#14 /usr/local/craftcms/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('save', Array)
#15 /usr/local/craftcms/vendor/craftcms/cms/src/web/Application.php(360): yii\base\Module->runAction('elements/save', Array)
#16 /usr/local/craftcms/vendor/craftcms/cms/src/web/Application.php(659): craft\web\Application->runAction('elements/save', Array)
#17 /usr/local/craftcms/vendor/craftcms/cms/src/web/Application.php(322): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#18 /usr/local/craftcms/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /app/web/index.php(26): yii\base\Application->run()
#20 {main} {"memory":11293984,"exception":"[object] (TypeError(code: 0): craft\\web\\View::renderString(): Argument #1 ($template) must be of type string, null given, called in /usr/local/craftcms/vendor/craftcms/webhooks/src/Plugin.php on line 188 at /usr/local/craftcms/vendor/craftcms/cms/src/web/View.php:646)"} 

Craft CMS version

5.8.11

PHP version

8.2.26

Operating system and version

Linux 6.10.14-linuxkit

Database type and version

PostgreSQL 17.5

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.1-32)

Installed plugins and versions

Image

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