TUSD pre-create hook not being called

521 Views Asked by At

The pre-create in tusd seems not to be called. It is a simple sh script called pre-create as follows:

#!/bin/sh
echo "\n\n == Start PRE-CREATE\n\n"

The logs generated by the server show:

[tusd] 2020/03/21 17:17:20 event="HookInvocationStart" type="pre-create" id="" [tusd] 2020/03/21 17:17:20 event="HookInvocationFinish" type="pre-create" id=""

While others show this log:

[tusd] 2020/03/21 17:17:20 event="HookInvocationStart" == Start POST-CREATE

I do know that if the pre-create script does not have exec permissions I get an error indicating permissions issues.

Executing ./pre-create from the command line does display the proper message.

Any ideas?

1

There are 1 best solutions below

0
On

For blocking hooks (which pre-create is one of), tusd will only forward the output of stderr to its logs. The hook's stdout is not logged by tusd because the stdout is sent to the tus clients in case of an error.

The echo command writes to stdout, so it does not show up in tusd's logs.

More information is available at https://github.com/tus/tusd/issues/428.