Ctx.request.body data changed in policy not available in model lifecycle

System Information
  • Strapi Version: 3.5.1
  • Operating System: MacOS Big Sur
  • Database: Mysql 5.7
  • Node Version: 12.20.1
  • NPM Version: 6.14.10
  • Yarn Version: 1.22.5

I’m trying to create a similar history feature in my app as this video:

This video was published last year.

I’m doing everything exactly the same as in the video, but when I’m changing the request data in the config/policies/ctx.js file, it is not available in the model lifecycle afterCreate/afterUpdate method.

I can see the changes are there when I’m doing a console.log with ctx.request.body in the policy file (which means that the policy is being applied), but when I do a console.log in the lifecycle method, the extra data I add is not there.

Can someone please help me identify the issue?

1 Like

Can you share your code for:

  • ./middlewares/ctx/index.js
  • ./config/policies/ctx.js
  • ./config/middleware.js
  • and the lifecycle file

I can reproduce the same behavior on Strapi v3.6.11