aws-amplify / aws-amplify/amplify-data

Provide a way to access secondary index name in lambda function

Open
#436 1 comment 0 reactions 0 assignees View on GitHub
data-schema feature-request Gen 2 transferred
Dominant language
TypeScript
Stars
18
Forks
23
Avg merge
26m
Merged PRs (30d)
1

Description

### Environment information

```plain text
System:
OS: macOS 15.0
CPU: (8) arm64 Apple M3
Memory: 114.58 MB / 24.00 GB
Shell: /bin/zsh
Binaries:
Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
Yarn: undefined - undefined
npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
pnpm: 9.11.0 - ~/.nvm/versions/node/v22.8.0/bin/pnpm
NPM Packages:
@aws-amplify/auth-construct: 1.3.1
@aws-amplify/backend: 1.3.0
@aws-amplify/backend-auth: 1.2.0
@aws-amplify/backend-cli: 1.2.8
@aws-amplify/backend-data: 1.1.4
@aws-amplify/backend-deployer: 1.1.4
@aws-amplify/backend-function: 1.5.0
@aws-amplify/backend-output-schemas: 1.2.0
@aws-amplify/backend-output-storage: 1.1.2
@aws-amplify/backend-secret: 1.1.3
@aws-amplify/backend-storage: 1.2.0
@aws-amplify/cli-core: 1.1.3
@aws-amplify/client-config: 1.3.2
@aws-amplify/deployed-backend-client: 1.4.1
@aws-amplify/form-generator: 1.0.3
@aws-amplify/model-generator: 1.0.8
@aws-amplify/platform-core: 1.1.0
@aws-amplify/plugin-types: 1.3.0
@aws-amplify/sandbox: 1.2.2
@aws-amplify/schema-generator: 1.2.4
aws-amplify: 6.6.3
aws-cdk: 2.160.0
aws-cdk-lib: 2.158.0
typescript: 5.6.2
AWS environment variables:
AWS_STS_REGIONAL_ENDPOINTS = regional
AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables
npm notice
npm notice New patch version of npm available! 10.8.2 -> 10.8.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
npm notice To update run: npm install -g npm@10.8.3
npm notice
```

### Describe the feature

Get the secondary index name programmatically.

### Use case

To query dynamodb items in lambda function.

This is my model definition:

```typescript
import { a } from "@aws-amplify/backend";

export default a
.model({
id: a.id().required(),
key: a.ref("ConfigurationKey").required(),
booleanValue: a.boolean(),
stringValue: a.string(),
})
.secondaryIndexes((index) => [index("key")]);

```

Secondary index generated in dynamodb:

Bildschirmfoto 2024-10-02 um 22 34 44

Contributor guide

Open the contributing guide

Research direction

Start from the TypeScript model definition and the generated DynamoDB secondary index described in the issue. Trace how the model and its index metadata become available to the Lambda function, then identify the existing tests or entry points for generated model configuration. Done means a Lambda can obtain the secondary index name programmatically and use it to query DynamoDB.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.