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

Unable to create a table with Sort Key #149

Open
justindra opened this issue Dec 26, 2021 · 1 comment
Open

Unable to create a table with Sort Key #149

justindra opened this issue Dec 26, 2021 · 1 comment

Comments

@justindra
Copy link

When I create multiple tables and one of them has a SortKey, that table does not exist when the test runs.

With the following Table Configuration:

export const tableConfigurations: TableConfiguration[] = [
  {
    TableName: 'agencies',
    KeySchema: [{ AttributeName: 'id', KeyType: 'HASH' }],
    AttributeDefinitions: [{ AttributeName: 'id', AttributeType: 'S' }],
  },
  {
    TableName: 'services',
    KeySchema: [{ AttributeName: 'id', KeyType: 'HASH' }],
    AttributeDefinitions: [
      { AttributeName: 'id', AttributeType: 'S' },
    ],
  },
  {
    TableName: 'trips',
    KeySchema: [
      { AttributeName: 'route_id', KeyType: 'RANGE' },
      { AttributeName: 'service_id', KeyType: 'HASH' },
    ],
    AttributeDefinitions: [
      { AttributeName: 'route_id', AttributeType: 'S' },
      {
        AttributeName: 'service_id',
        AttributeType: 'S',
      },
    ],
  },
];

When running Client.listTables() in the tests, the result is:

{ TableNames: [ 'agencies', 'services' ] }

Instead of

{ TableNames: [ 'agencies', 'services', 'trips' ] }

If I remove the SortKey for the trips table, the everything works as expected
@the-wondersmith
Copy link

@justindra I ran into this same issue and ended up creating a patch for it. I've created a PR for said patch, hopefully @mhart or someone else with merge authority will see it. I can't promise that it's correct (as I'm primarily a Python/Rust programmer and am only passable in JS), but I can assure that it does work.

If you need the change like right now, I think you can either manually apply the patch to the source files in your local (global) node modules or you can tell npm to use my branch instead of mainline Dynalite until the patch is merged (assuming it does in fact get merged).

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

No branches or pull requests

2 participants