Closed wardAndrew closed 3 years ago
Stack trace java.lang.IllegalArgumentException: Cannot create enum from us-iso-east-1 value! at com.amazonaws.regions.Regions.fromName(Regions.java:92) at com.amazonaws.jenkins.plugins.sam.util.BeanHelper.doFillRegionItems(BeanHelper.java:20) at com.amazonaws.jenkins.plugins.sam.DeploySettings$DescriptorImpl.doFillRegionItems(DeploySettings.java:185) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145) at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
Excuse me, how to solve this problem?
Excuse me, how to solve this problem?
@whr845736938 Here is my synopsis of the problem:
Issues: Error is Cannot create enum from us-iso-east-1 value!
Root Cause: The core of the issue I think is in this part of the code: https://github.com/jenkinsci/aws-sam-plugin/blob/cd39d25b18165bedfa0e98f3181e828f8bc968cb/src/main/java/com/amazonaws/jenkins/plugins/sam/util/BeanHelper.java#L20
This is because of the class not supporting the region you are in as seen here: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/regions/Regions.html
Resolution: Given this region is not supported on the AWS side, there is not much that can be done in this plugin
Suggestion: I would suggest writing your code in bash (using the awscli which does support this region) or python (using boto3 library which also supports this region). While this is not an ideal scenario it might be a quicker fix than waiting for AWS to update. Hope this helps and I will also note this in the gitter channel.
Perhaps we can simply try..catch and allow only those that can be resolved. Emitting an errror on the catch, viewable in the console may be adequate.
I made this change, as I was stuck; a maven rebuild, and dropped the jar into the jenkins plugin folder (/var/lib/jenkins/plugins/aws-sam/WEB-INF/lib) .
public class BeanHelper { public static ListBoxModel doFillRegionItems() { ListBoxModel list = new ListBoxModel(); for (Region region : RegionUtils.getRegions()) { try { Regions regionData = Regions.fromName(region.getName()); list.add(regionData.getDescription(), regionData.getName()); } catch(Exception e) { // TODO - emit an error } } return list; } }
Perhaps we can simply try..catch and allow only those that can be resolved. Emitting an errror on the catch, viewable in the console may be adequate.
I made this change, as I was stuck; a maven rebuild, and dropped the jar into the jenkins plugin folder (/var/lib/jenkins/plugins/aws-sam/WEB-INF/lib) .
public class BeanHelper { public static ListBoxModel doFillRegionItems() { ListBoxModel list = new ListBoxModel(); for (Region region : RegionUtils.getRegions()) { try { Regions regionData = Regions.fromName(region.getName()); list.add(regionData.getDescription(), regionData.getName()); } catch(Exception e) { // TODO - emit an error } } return list; } }
Can you upload the .jar file for me? I don't know how to re-build source code.
I am experiencing this issue also.
This should now be fixed in 1.2.5; closing.
https://github.com/jenkinsci/aws-sam-plugin/blob/cd39d25b18165bedfa0e98f3181e828f8bc968cb/src/main/java/com/amazonaws/jenkins/plugins/sam/util/BeanHelper.java#L20