Unable to update hook

When updating a hook containing certain code using the deploy cli, the update fails.

Deploying this code with the CLI works fine. However, when running the same deploy again, it breaks. I am only deploying this and some Rules (importing from directories), and this is the part that does not work. From what I gather, deployment of hooks fails if some faulty code is already present within the hook. If you manually delete the hook, deployment works again. Allow delete is set to false.

A second run of the import command produces this:

Changing the code in the hook to the following fixed the issue:

I speculate that it has something to do with the callbacks, branching etc. But I could not figure out how to properly structure it so deployment worked. And even if my code was faulty, I’d expect it to either deploy anyway or fail on first deploy. And I would also expect a better error.

Deploy CLI version is 5.2.1

I have exactly the same problem. Anyone got a suggestion? This is quiet a common issue , please suggest me if you find any solution for it .

Checked with importing from yaml too, same problem.

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!