Author a non‑HTTP function and attach an SQS event via a sibling serverless.ts.
import { z } from 'zod';
import { app } from '@/app/config/app.config';
export const eventSchema = z.any(); // validate as needed
export const responseSchema = z.void(); // or z.any().optional()
export const fn = app.defineFunction({
eventType: 'sqs',
eventSchema,
responseSchema,
callerModuleUrl: import.meta.url,
endpointsRootAbs: /* app/functions/sqs root */,
});
import { fn } from './lambda';
export const handler = fn.handler(async (event) => {
// process SQS batch event
void event;
});
import { fn } from './lambda';
fn.serverless([
{ sqs: { arn: 'arn:aws:sqs:us-east-1:123456789012:my-queue' } },
]);
Notes
app/generated/register.serverless.ts in your top‑level serverless.ts.