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

Invalid AWS Mock Access Key ID through a new AWS-SDK version #299

Open
henriklippke opened this issue Jul 1, 2023 · 5 comments
Open

Invalid AWS Mock Access Key ID through a new AWS-SDK version #299

henriklippke opened this issue Jul 1, 2023 · 5 comments

Comments

@henriklippke
Copy link
Contributor

Due to a new AWS_SDK version only the following ACCESS KEY ID and SECRETS are allowed:

DynamoDB local version 2.0.0 and greater AWS_ACCESS_KEY_ID can contain the only letters (A–Z, a–z) and numbers (0–9).

Stackoverflow thread

I've already created a PR to fix this issue:
#298

@whitneylarow
Copy link

Thanks for the PR! This issue is blocking our pipelines as well. Any ideas for a workaround in the meantime?

@rahulp959
Copy link

@henriklippke -- I've published a fork to npm with your changes in.

I haven't yet gotten a chance to try it (I'll do so later this morning in some of my other projects)

Let me know if there's any issues.

https://www.npmjs.com/package/@rahulp959/serverless-dynamodb-local

@yanaSelin
Copy link

As temp solution for me helped to inherit serverless-dynamodb-local plugin with local one and override dynamodbOptions method as per @henriklippke PR, and use this plugin in my project

class ServerlessDynamodbLocalFix extends ServerlessDynamodbLocal {
  dynamodbOptions(options) {
    let dynamoOptions = {};

    if (options && options.online) {
      ...
    } else {
      dynamoOptions = {
        endpoint: `http://${this.host}:${this.port}`,
        region: 'localhost',
        accessKeyId: 'MOCKACCESSKEYID',
        secretAccessKey: 'MOCKSECRETACCESSKEY',
        convertEmptyValues:
          options && options.convertEmptyValues ? options.convertEmptyValues : false,
      };
    }

    return {
      raw: new AWS.DynamoDB(dynamoOptions),
      doc: new AWS.DynamoDB.DocumentClient(dynamoOptions),
    };
  }
}
module.exports = ServerlessDynamodbLocalFix;

@oshea00
Copy link

oshea00 commented Jul 3, 2023

Wrapping a jar file in a node module used by a plugin. What could possibly go wrong?

@domdomegg
Copy link

domdomegg commented Jul 4, 2023

Another option for a longer-term workaround with ongoing maintenace support committed:

Why: Unfortunately this package (serverless-dynamodb-local) doesn't appear to be maintained, with no new releases to NPM in over 2 years. Many have tried to contact the authors previously, but there seems to be little engagement. Additionally, the person who seemed to be in charge of their open-source work has now left the company.

Solution: You can use serverless-dynamodb, a maintained fork, instead. (Disclaimer: I am a contributor to this fork). It is a drop-in replacement for this package, and is updated to fix this bug. This is a drop-in replacement for serverless-dynamodb-local, so to upgrade simply:

  1. Uninstall serverless-dynamodb-local, e.g. npm uninstall serverless-dynamodb-local
  2. Install serverless-dynamodb, e.g. npm install serverless-dynamodb
  3. Update references in your code, including your serverless config, from serverless-dynamodb-local to serverless-dynamodb (quite possible that you won't have any, as you just refer to it from your serverless config)
  4. (optional) Update your serverless config custom dynamodb key to serverless-dynamodb

Of course, it's all still open-source and MIT licensed. Ownership of this new package sits with a registered charity, that is committed to maintaining the package into the future and is open to contributions from the community.

There's an explanation as to the intentions behind this fork, and how it compares to other forks in the README.

In any case would be open to feedback on the fork - can drop create an issue in that repository or email me (address on profile).

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

6 participants