Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET request providing only partitionKey on a table with a defined sortKey results in error #402

Open
bwermes opened this issue Jan 28, 2023 · 0 comments

Comments

@bwermes
Copy link

bwermes commented Jan 28, 2023

Describe the bug
When performing a GET request providing only the partitionKey against a table that also contains a sortKey results in an error:
please provide the sort key for the attribute name

My table contains

To Reproduce
Steps to reproduce the behavior:

  1. Create a table with a PartitionKey and a SortKey:
    `@Model({tableName: 'Sample'})
    export class className{
    @PartitionKey()
    pk: string

    @SortKey()
    sk: string

    name: string;

    public constructor(init?: Partial) {
    Object.assign(this, init);
    }
    }`

  2. Perform a GET request against that table:
    const sample = await new DynamoStore(Sample).get('myPartitionKey');

  3. Observe the error

Expected behavior
The GET method provides for the SortKey as optional. Other Dynamo libraries allow you to query a single record by PartitionKey only, returning the first record if multiple exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant