n8n
n8n copied to clipboard
Clockify Trigger Polling not working
Describe the bug
The Clockify trigger is not being fired when the polling rates (Poll Times) of the trigger node are shorter than the tracked time-entry in Clockify. This means that the polling rate has to be higher than the length of the event if you want to use the Trigger node.
Here you can see the code containing the bug:
https://github.com/n8n-io/n8n/blob/6dcdb30bf41443099f4abea54f9399f43e9de915/packages/nodes-base/nodes/Clockify/ClockifyTrigger.node.ts#L109-L110
The Clockify-API gets sent a request within a period of time between the last point in time the API was checked and now.
The variable webhookData.lastTimeChecked
is set to now right beneath this.
The problem of this approach is, that only time-entries within Clockify that have their start AND end time between webhookData.lastTimeChecked
and now are being requested from the API.
If I start and stop a timer after a few seconds, the trigger gets fired within a minute (if I have the polling rate set to the min value).
But any timer that's longer than that doesn't get requested, because the API only returns entries that are completely within the time-range, not just partially.
Idea for an easy fix
A fix could be setting qs.start
to the end of the last finished timer-entry of the workspace.
Workaround
In the meantime and if others are looking for a temporary solution, here's a (suboptimal) workaround: It depends on what you're doing, but if your automation is not time-sensitive, then you can set the polling rate to "Every Day" or even longer to expand the maximum length of Clockify-events that can trigger the node.
Here is a link to the forum where this issue was being discussed: https://community.n8n.io/t/polling-not-working-or-am-i-doing-something-wrong/10576/3