zapier / zapier-platform

The SDK for you to build an integration on Zapier
https://platform.zapier.com
Other
344 stars 188 forks source link

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

Open mateop42dev opened 2 months ago

mateop42dev commented 2 months ago

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.