Skip to main content

Receive updates on Functionless.

Write your application and infrastructure code together with Functionless

const bus = new EventBus<Event<{ name: string }>>(this, 'bus');
const validateName = new Function<string, boolean>(this, 'validateName', async (name) => {
const result = await fetch(`http://my.domain.com/validate/${name}`);
return result.status === 200;
});
const sfn = new StepFunction(this, 'sfn', async (props: {name: string}) => {
// if name is valid
if(validateName(name)) {
// send a notification to the event bus.
await bus.putEvents({
source: 'magicApplication',
'detail-type': 'form-submit',
detail: {
name
}
});
}
});
sfn.onFailed('failedRule').pipe(new Function(this, 'failedWorkflows', async (event) => {
console.log(event);
});