seratch/AWScala

Cannot create enum from eu-north-1 value!

jurgispods opened this issue · 7 comments

Hi,

after months of smooth operation, I just got the following error:

19/11/18 14:02:42 ERROR ApplicationMaster: User class threw exception: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
        at awscala.package$.<init>(package.scala:3)
        at awscala.package$.<clinit>(package.scala)
[...]
Caused by: java.lang.IllegalArgumentException: Cannot create enum from eu-north-1 value!
        at com.amazonaws.regions.Regions.fromName(Regions.java:88)
        at awscala.Region0$.apply(Region0.scala:12)
        at awscala.Region0$.<init>(Region0.scala:57)
        at awscala.Region0$.<clinit>(Region0.scala)
        ... 24 more

The offending line in my code is:

implicit val s3: awscala.s3.S3 = S3.at(Region.Frankfurt)

That's odd, because Frankfurt is eu-central-1 and has nothing to do with the eu-north-1 region.

It happens during an AWS EMR job. Any ideas what is going on here?

In my case, after updating awscala to 0.8.3, the error is occurred. So, I've tried to use awscala 0.8.2, it is not raised.

I do not know a reason. However, I assume that 0.8.3 version has some problems or changes for using APIs.

You can try to change dependencies option like that,

libraryDependencies += "com.github.seratch" %% "awscala" % "0.8.2" 

diff: 0.8.2...0.8.3

-lazy val awsJavaSdkVersion = "1.11.541"
+lazy val awsJavaSdkVersion = "1.11.621"

Which AWS SDK version does your app depend on? I'm afraid the problem may be caused by some binary compatibility issues among AWS SDK versions.

Surely, the version of sdk used in my app is written in awscala's build sbt file. It is not overwritten and manually set. When I use 0.8.3, awsJavaSdkVersion is "1.11.621".

I'm not sure that it is a general problem among AWS SDK versions. However, In my case, the error is occurred not in 0.8.2 but in 0.8.3.

My problem also started after an (unintentional) upgrade of this library. The AWS SDK used in EMR version 5.20.0 ist 1.11.461, which is "too old" for the current version 0.8.3. I just upgraded to a newer EMR version 5.28.0 and now everything works fine.

@seratch I dont' know if you want to add a workaround for the europe-north-1 region like here? https://github.com/seratch/AWScala/blob/master/core/src/main/scala/awscala/Region0.scala#L54

@pederpansen Thanks. I would like to cover all the regions in that code.

This breaks for me as well moving from "0.8.2" to "0.8.3" with same Cannot create enum from eu-north-1 value.

Merged #212

The fix will eliminate the possibility to have this exception in future versions. Allow me to close this issue now.