Why is File Store Feature Inaccessible within My Actions Component?

This topic was automatically generated from Slack. You can find the original thread here.

It appears that File Store feature is NOT accessible within My Actions component. $.files is not accessible due to security I assume, there’s NO way to pass that to the component as a prop, so file store is completely inaccessible.

It appears that File Store feature is NOT accessible within My Actions component. $.files is not accessible due to security I assume, there’s NO way to pass that to the component as a prop, so file store is completely inaccessible.

It appears that you’re encountering issues accessing the File Store within your custom action component. The $.files helper is indeed scoped to workflows and is not directly accessible within custom action components due to security constraints. To work around this limitation, you can use the following approach: 1. Use a Workflow to Access the File Store: Create a workflow that accesses the File Store and performs the necessary operations (e.g., reading, writing, or deleting files). 2. Trigger the Workflow from Your Action Component: Use an HTTP trigger or another method to call this workflow from your custom action component. Here’s an example of how you can set this up: ### Step 1: Create a Workflow to Access the File Store Create a new workflow with an HTTP trigger and a code step to access the File Store. For example, to read a file: import { axios } from "@pipedream/platform"; export default defineComponent({ async run({ steps, $ }) { // Open the file by its path in the File Store const file = $.files.open('example.png'); // Log the S3 URL to access the file publicly const fileUrl = await file.toUrl(); return { fileUrl }; }, }); ### Step 2: Trigger the Workflow from Your Action Component In your custom action component, make an HTTP request to trigger the workflow created in Step 1: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ props: { workflowUrl: { type: “string”, label: “Workflow URL”, description: “The URL of the workflow to trigger”, }, }, async run({ steps, $ }) { // Trigger the workflow and get the file URL const response = await axios($, { method: “POST”, url: this.workflowUrl, }); return response; }, });

Thank you, is there no way to turn this into a feature request. It appears to be a hacky work around, considering this is My Components, not a 3rd party thing, shouldn’t my components have access to the Filestore?

So we can create code steps that work when using the file store, but if we export them to “My Actions”, then they suddenly stop working?!? :face_with_raised_eyebrow:

Not what I’d expect either…

The data store is available in My Actions… so I don’t see why the file store wouldn’t be. :man-shrugging:

Posted thread to Discourse: Why is the File Store Feature Inaccessible Within My Actions Component?

I ran into the same issue. I am trying to split our code into reusable actions. Whilst refactoring a component using the file store into an action, it stopped working.
The execution scope of the action is the exact same, nothing else changed. Can we please get this fixed or a reasonable workaround provided?

Yes, I found an open feature request here: [FEATURE] Enable File Store for publishable actions · Issue #9279 · PipedreamHQ/pipedream · GitHub
cc

Similar request (built-in components for File Stores): [ACTION] File Store · Issue #9154 · PipedreamHQ/pipedream · GitHub

Looking into this with the team and I’ll follow up one I have an update. Thanks for flagging.

amazing, thank you