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

conditional maxInstances #199

Merged
merged 3 commits into from
Feb 27, 2020

Conversation

holmerjohn
Copy link
Contributor

I have still never been able to make this fail a test in Jest, but when run within the context of a sls deploy the configuration-template-update.yml file can be malformed if the maxInstances valus is not set for the function. This PR checks for the existence of the property on the funcObject and then maps the value over if it is found. This has been tested to deploy a project that contains multiple functions, some of which include maxInstances, and some do not. The deployed functions in the console that do not declare a maxInstances are unrestricted, and those that do are restricted as configured in the serverless.yml

An example of the error output from the malformed yml:

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Compiling function "http-config"...
Serverless: Compiling function "pubsub-echo"...
Serverless: Compiling function "pubsub-refresh-auth"...
Serverless: Uploading artifacts...
Serverless: Artifacts successfully uploaded...
Serverless: Updating deployment...
 
  Error --------------------------------------------------
 
  Error: Error parsing configuration: could not determine a constructor for the tag tag:yaml.org,2002:js/undefined
   in 'string', line 21, column 21:
            maxInstances: !<tag:yaml.org,2002:js/undefined> ''

@holmerjohn
Copy link
Contributor Author

This addresses newly created Issue #198

@medikoo medikoo linked an issue Feb 26, 2020 that may be closed by this pull request
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

@holmerjohn great thanks for that fix.

Can you update branch with master and confim CI passes? We've just upgraded package with better automated maintanance rules.

@holmerjohn
Copy link
Contributor Author

@medikoo merged master and fixed the prettier file. ci passes. thanks

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @holmerjohn !

@medikoo medikoo merged commit 4ea8418 into serverless:master Feb 27, 2020
@holmerjohn holmerjohn deleted the iss-198-conditional-max-inst branch February 28, 2020 00:02
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.

Function without maxInstances create invalid template
2 participants