Skip to main content

Lifecycle hooks are triggered differently with the Document Service API methods

In Strapi 5, database lifecycle hooks are triggered differently with the various Document Service API methods, mainly due to the new way the Draft & Publish feature works.

This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

🔌 Is this breaking change affecting plugins?Yes
🤖 Is this breaking change automatically handled by a codemod?No

Breaking change description

In Strapi v4

In Strapi v4, lifecycle hooks work as documented in the Strapi v4 documentation.

In Strapi 5

Lifecycle hooks work the same way as in Strapi v4 but are triggered differently, based on which Document Service API methods are triggered. A complete reference is available (see notes).

Migration

This section regroups useful notes and procedures about the introduced breaking change.

Notes

The Document Service API: Lifecycle hooks documentation lists how database lifecycle hooks are triggered based on which Document Service API methods are called.

Manual procedure

Users might need to adapt their custom code to how lifecycle hooks are triggered by Document Service API methods in Strapi 5.