Workflow app external script not being invoked

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 27.1.5
Operating system and version (eg, Ubuntu 20.04): Ubuntu22.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52 (Ubuntu)
PHP version (eg, 7.4): PHP 8.1.2-1ubuntu2.14

The issue you are facing:
I cannot seem to get my external script workflow to trigger.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Create a folder called Projects with a tag called ProjectFiles
  2. Create a tag in admin settings called ToBeTranscripted
  3. Create a subfolder in Projects
  4. Create a files-automated-tagging rule like this:

  1. Create another workflow rule to run an external script like this:

  1. Upload File.ogg to your subfolder, and check that it got the tag as per the first rule. Once confirmed, check Nextcloud log to see if your external script has been called, it would not have been.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"Flow activation: rules were requested for operation Automated tagging","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"Flow rule qualified to run Automated tagging, config: {\"id\":1,\"class\":\"OCA\\FilesAutomatedTagging\\Operation\",\"name\":\"\",\"checks\":\"[1,5]\",\"operation\":\"2\",\"entity\":\"OCA\\WorkflowEngine\\Entity\\File\",\"events\":\"[]\",\"scope_type\":0,\"scope_actor_id\":\"\"}","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":1,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"All qualified flow configurations are going to run Automated tagging","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"app":"workflowengine","level":"1"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"Flow activated by event OCP\\SystemTag\\ISystemTagObjectMapper::assignTags","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"Flow activation: rules were requested for operation Run script","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"No flow configurations is going to run Run script","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":1,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"Flow handling done for event OCP\\SystemTag\\ISystemTagObjectMapper::assignTags","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"app":"workflowengine","level":"1"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"Flow activation: rules were requested for operation Automated tagging","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}
{"reqId":"fH2SwUc2BeKsWno1b2fz","level":0,"time":"January 05, 2024 14:52:48","remoteAddr":"My.IP.Address","user":"admin","app":"workflowengine","method":"POST","url":"/index.php/apps/integration_openproject/direct-upload/JwgbEfXYAnqbw4g5opqRykJfEDDojFQCnKwpRpWrA8H4WQkHYG5MqGe9iD5jXn45","message":"No flow configurations is going to run Automated tagging","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0","version":"27.1.5.1","data":{"level":"0","app":"workflowengine"}}

So yes, I have used the OpenProject integration, but that should not matter. I know everyone is forever being told “Search first” and I have, but I cannot find any solution that helps me figure out why the second trigger is not working.

What I want to achieve:

A voicenote or anything similar is uploaded to OpenProject via a task. This audio file is placed into Nextcloud, in a specific folder created by OpenProject. Because it is an audio file, it is tagged with ToBeTranscripted (yes I will fix this wording) which in turn needs to trigger the second workflow, where the file is passed to a bash script in /usr/local/bin/ and I can run my local transcription service on it. Once done I can use the variables I got from the %n flag to ensure I upload it back into the correct folder so the user can see it in a list of files inside OpenProject.

Current content of /usr/local/bin/transcribe.sh

#!/bin/bash

echo "$(date +"%Y-%m-%d %H:%M:%S %Z") - $@" >>  /var/log/transcribe.log
echo $1 > /tmp/test.txt

There is no log created, and neither is there a file created in /tmp/ so between this and the outputs from the Nextcloud log, it is clear that this external script is never even called.

Any idea why the second never even wants to invoke?

TIA for any help!

Anyone have an idea?

@j-ed sorry to tag you, just saw your name pop up quite a bit in some of the other topics in the ‘flow’ tag. Do you perhaps have any ideas what I can look at and try? I am banging my head here.

@Starfish I’ve never user this function but I my asuption is that maybe the first tagging isn’t done correctly, because of a mime type mismatch. Have you checked if the tag exists on the file and if not what exact mime type the system recognizes for the file?

So it seems the first job does in fact execute correctly.

If the file is tagged correctly I can only assume that a race condition appears which prevents the correct execution of the script.

If we have a look on the log lines you provide, you can see that the tagging rule is initiated and also the script execution rule, but I’m not sure if the first task has already finished at that time. Based on the available messages in workflowengine/lib/Service/Logger.php it might be possible that the end of a successful rule execution should be signaled by the message “Flow handling done for event”.