Viktor H. Morales
Viktor H. Morales

Reputation: 31

Directus Flow: Run custom function within a Flow

Good day everyone,

I am using the Docker version of Directus.

I have the following Flow:

- Cron Job > Read Data > Run Script

But I want to "Run Function" instead as "Run script" is limited and cannot "import" nor "require" external libraries on it.

I know that I can run an API Endpoint / Webhook. So basically my question is if that I can create a custom extension with an API endpoint and then run it on the Flow, or if it is possible to "Run function".

What I want to do is to run Puppeteer inside a Flow:

- Cron Job > Read Data > Loop through the "read data" returned information and run puppeteer to return information.

I hope this question is clear.

Regards.

I tried "Run Script" but for security reasons doesn't allow "import" or "require" external libraries (Puppeteer, for example).

Upvotes: 2

Views: 1944

Answers (2)

tobius
tobius

Reputation: 855

Add a CSV list of trusted Node modules to the FLOWS_EXEC_ALLOWED_MODULES env var and restart your container. Now you can import those Node modules.

It's mentioned in the docs: https://docs.directus.io/self-hosted/config-options.html

Upvotes: 0

Son Nguyen Hoang
Son Nguyen Hoang

Reputation: 11

You can just send a HTTP request to that custom endpoint I guess?

Upvotes: 0

Related Questions