zapier-platform icon indicating copy to clipboard operation
zapier-platform copied to clipboard

[Bug]: Can't stash files in a Trigger hook's perform.

Open mateop42dev opened this issue 6 months ago • 0 comments

Bug Description

You can't stash files in a Trigger hook's perform.

Reproduction Steps

  1. Use an Typescript app
  2. Create a trigger file with a perform method, etc... and declare it as a triggers in your index
  3. Create hydrator.js with a downloadFile() method which use z.stashfiles with binary data, and declare it as an hydrators in your index
  4. Import hydrators and call hydrators.downloadFile() in your perform methods from your trigger. If you're looking at the logs, it's going into the downloadFile method, but you're getting a "Files can only be stashed within a create or hydracation function/method" error.

Zapier Platform version

15.10.0

Node.js version

20.11.0

Your Operating System

Windows 10

npm/yarn version

10.2.4

App ID

No response

More Details

The problem is that only Hydrators and Creates can stash files, but even if you use an hydrator methods IN a hook's perform, the zapier.event will start by triggers.(...).perform, and not by hydrations. So an error will be throwed. (altought documentation is saying that you can stash files in an hydration method or an hook's perform...) This is at least the case in a typescript project.

mateop42dev avatar Jul 25 '24 15:07 mateop42dev