Registering after hook for WriteStorageObjects

Using a Lua module, the after hook for AuthenticateCustom fires. Fresh data is being saved to a user storage object, but for some reason the after hook for WriteStorageObjects doesn’t fire.

Any idea why this might be? I’m using the ids from the documentation.

This is the code:

local function on_after_authenticate_custom(context, payload)


local function on_after_write_storage_objects(context, payload)



nk.register_req_after(on_after_authenticate_custom, "AuthenticateCustom") 
nk.register_req_after(on_after_write_storage_objects, "WriteStorageObjects")

Hello @totebo,

Before and after hooks are only applied to client messages/API calls. If you want to reuse the logic, you can extract it and call it explicitly in both hooks.

In the runtime, you should be able to express complex code and patterns.

Got it. Thanks for the reply!