Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflow step execution sample code to not await the workflowSteps Slack API responses #1178

Merged
merged 4 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions docs/_steps/executing_workflow_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ const ws = new WorkflowStep('add_task', {
taskDescription: inputs.taskDescription.value,
};

// if everything was successful
// signal back to Slack that everything was successful
await complete({ outputs });

// if something went wrong
// fail({ error: { message: "Just testing step failure!" } });
// NOTE: If you run your app with processBeforeResponse: true option,
// `await complete()` is not recommended because of the slow response of the API endpoint
// which could result in not responding to the Slack Events API within the required 3 seconds
// instead, use:
// complete({ outputs }).then(() => { console.log('workflow step execution complete registered'); });

// let Slack know if something went wrong
// await fail({ error: { message: "Just testing step failure!" } });
// NOTE: If you run your app with processBeforeResponse: true, use this instead:
// fail({ error: { message: "Just testing step failure!" } }).then(() => { console.log('workflow step execution failure registered'); });
},
});
```
```
10 changes: 7 additions & 3 deletions docs/_steps/ja_executing_workflow_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ const ws = new WorkflowStep('add_task', {
};

// もし全て OK なら
await complete({ outputs });
// ここでは await complete() はおすすめしません。呼び出す API の応答が遅いためです。
// これにより、3 秒以内に Slack のイベント API に応答することができなくなる場合があります。
// 代わりに以下のようにすることができます:
// complete({ outputs }).then(() => { console.log('workflow step execution complete registered'); });
complete({ outputs }).then(() => { console.log('workflow step execution complete registered'); });
filmaj marked this conversation as resolved.
Show resolved Hide resolved

// もし何か問題が起きたら
// fail({ error: { message: "Just testing step failure!" } });
// fail({ error: { message: "Just testing step failure!" } }).then(() => { console.log('workflow step execution failure registered'); });
},
});
```
```