API Reference
    Preparing search index...
    SqsEnvelope: {
        parse<T extends ZodType<any, ZodTypeDef, any>>(
            data: unknown,
            schema: T,
        ): TypeOf<T>[];
        safeParse<T extends ZodType<any, ZodTypeDef, any>>(
            data: unknown,
            schema: T,
        ): ParsedResult<unknown, TypeOf<T>[]>;
    } = ...

    SQS Envelope to extract array of Records

    The record's body parameter is a string and needs to be parsed against the provided schema.

    If you know that the body is a JSON string, you can use JSONStringified to parse it, for example:

    import { JSONStringified } from '@aws-lambda-powertools/helpers';
    import { SqsEnvelope } from '@aws-lambda-powertools/parser/envelopes/sqs';

    const schema = z.object({
    name: z.string(),
    });

    const parsed = SqsEnvelope.parse(event, JSONStringified(schema));

    Type declaration

    • parse: function
      • Type Parameters

        • T extends ZodType<any, ZodTypeDef, any>

        Parameters

        • data: unknown
        • schema: T

        Returns TypeOf<T>[]

    • safeParse: function