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

Apply table name #257

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open

Conversation

joedevgee
Copy link

Fixes issue #107

Changes: When no table name is provided in serverless.yml, use the dynamic generated table name

When no table name is provided in serverless.yml, use the dynamic generated table name
@joedevgee joedevgee marked this pull request as draft November 29, 2020 04:51
@joedevgee
Copy link
Author

@AshanFernando please review this

@joedevgee joedevgee marked this pull request as ready for review November 29, 2020 04:52
if (!resources[key].Properties.TableName) {
const service = this.service.service;
const stage = this.options.stage || this.service.provider.stage;
resources[key].Properties.TableName = `${service}-${stage}-${key}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding the service name to the TableName it can pretty easily reach the 256 char max length that DynamoDB has for its name. What about limiting the name to stage-key?

Suggested change
resources[key].Properties.TableName = `${service}-${stage}-${key}`;
resources[key].Properties.TableName = `${stage}-${key}`;

@jonoirwinrsa
Copy link

This works great for me - would be nice to see it merged

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

Successfully merging this pull request may close these issues.

3 participants