A workflow endpoint should always produce the same results, even if it’s called multiple times. Avoid:
- Non-idempotent functions
- Time-dependent code
- Randomness
Example of what to avoid:
If you implement a non-idempotent code like the one shown above, you might encounter Failed to authenticate Workflow request. errors. This can happen if you return based on the result of the non-idempotent code before any workflow step.
To prevent this, ensure that the non-idempotent code (such as getResultFromDb in the example) runs within context.run.