The @aws-amplify/amplify-category-function package is an official Amplify CLI plugin for managing AWS Lambda functions within an Amplify project. It provides commands to add, build, push, and remove function resources, leveraging AWS CloudFormation for infrastructure as code. The current stable version is 5.8.0 (part of Amplify CLI v14.3.0). It requires the Amplify CLI environment and is typically used via the `amplify` command-line interface. Key differentiators: tight integration with Amplify's backend management, automatic IAM role generation, and support for multiple runtimes. Compared to raw AWS SDK usage, it abstracts away CloudFormation templates and provides a guided CLI workflow.
npm install amplify-category-functionVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to add, build, push, and remove an AWS Lambda function using the plugin's ESM imports. Assumes an existing Amplify project.
Use ES module imports: `import { add } from '@aws-amplify/amplify-category-function'`.Use the `add` function with options object instead of relying on CLI prompts.
Ensure the directory exists before calling `add`, or use the interactive CLI which creates it.
Update code to handle pagination with smaller page size.
For non-Node.js runtimes, use external build tools and ensure the output is placed in the source directory.
Run `npm install @aws-amplify/amplify-category-function` or ensure it's added to your Amplify project.
Change to `import { add } from '@aws-amplify/amplify-category-function'`.Use a different name, or remove the existing function first with `remove`.
Ensure the specified path contains a handler file (e.g., index.js) with the correct export.