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

Setup hangs when using custom endpoint. #160

Closed
babatakao opened this issue Jul 20, 2022 · 4 comments
Closed

Setup hangs when using custom endpoint. #160

babatakao opened this issue Jul 20, 2022 · 4 comments
Assignees

Comments

@babatakao
Copy link

The endpoint configured in here can be overridden by jest-dynamodb-config.js. This is typically useful for docker-compose environment.

// jest-dynamodb-config.js
module.exports = () => {
  return {
    clientConfig: {
      endpoint: 'http://dynamodb:8000',
      region: 'localhost-test',
      credentials: { accessKeyId: "access-key", secretAccessKey: "secret-key" },
    },
  };
};

However, waitForLocalhost does not respect the custom endpoint config. It checks only localhost. This causes hanging-up with non-localhost endpoint.

Note that since jest-dynamodb 1.8.1 does not have waitForLocalhost check, custom endpoint worked well on that version. Thus, it feels like a regression for docker-compose users who do not want to launch dynamodb-local.

@harazdovskiy
Copy link
Contributor

Hi @babatakao, we are working on adding TS support, this will also include a fix for the issue you mentioned!

@harazdovskiy
Copy link
Contributor

@babatakao Here you can find new param and use it 🚀

  1. Readme
  2. Types

@babatakao
Copy link
Author

Thank you for the fix! I've confirmed the problem is resolved on my environment.

note for me: if clientConfig.endpoint is configured in some reason, it is also required to set hostname.

// jest-dynamodb-config.js
module.exports = () => {
  return {
    hostname: 'dynamodb', // this is required
    clientConfig: {
      endpoint: 'http://dynamodb:8000', // if this line exists
      region: 'localhost-test',
      credentials: { accessKeyId: "access-key", secretAccessKey: "secret-key" },
    },
  };
};

@harazdovskiy
Copy link
Contributor

Yes, you are right in order to avoid breaking changes for existing configs I added separate property instead of relying on endpoint in the client config.

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