zapier performResume 步骤未被等待/运行
Posted
技术标签:
【中文标题】zapier performResume 步骤未被等待/运行【英文标题】:zapier performResume step not being waited for / run 【发布时间】:2021-09-23 09:08:17 【问题描述】:我正在关注 zapier 中有关 callbackUrl https://platform.zapier.com/cli_docs/docs#zgeneratecallbackurl 的文档,但似乎无法运行 performResume 步骤。我基于此集成创建的 zap 似乎也没有等待 callbackUrl 被命中。
const createScreenshot = (z, bundle) =>
const callbackUrl = z.generateCallbackUrl();
const promise = z.request(
url: 'https://myapi.com/v1/render',
method: 'POST',
params: ,
headers:
'Content-Type': 'application/json',
Accept: 'application/json',
,
body:
...bundle.inputData,
webhook_url: callbackUrl
,
removeMissingValuesFrom: ,
);
z.console.log("Returning from perform / createScreenshot");
return promise.then((response) => ( ...response.data, waiting_for: "performResume" ));
const onScreenshotFinished = (z, bundle) =>
z.console.log("In performResume / onScreenshotFinished", bundle.cleanedRequest);
const responseBody = bundle.cleanedRequest;
let screenshotUrl;
if (responseBody.event === "render.succeeded")
z.console.log("render was processed successfully", responseBody);
screenshotUrl = responseBody.result.renderUrl;
return screenshotUrl, ...responseBody ;
z.console.log("render was not processed", responseBody);
throw z.errors.Error("Screenshot was not successful");
module.exports =
operation:
perform: createScreenshot,
performResume: onScreenshotFinished,
...
【问题讨论】:
【参考方案1】:我们在 GitHub (zapier/zapier-platform#398) 上讨论了这个问题(及其解决方案),但总结一下给 SO 读者:
在设置可恢复 Zap 时,编辑器使用 sample
在回调中填充数据。在设置过程中不会发生实际等待。一旦 zap 上线,它就会像往常一样工作。
所以,要实现:
perform
应该返回与“resume” webhook 发送的数据相匹配的样本数据
performSubscribe
可以读取该数据并正常运行
有关更多信息,请参阅 GH 问题。
【讨论】:
以上是关于zapier performResume 步骤未被等待/运行的主要内容,如果未能解决你的问题,请参考以下文章