aws-sdk-scalajs-facade icon indicating copy to clipboard operation
aws-sdk-scalajs-facade copied to clipboard

Request.on() callback does not get anything at run time.

Open dduquesne opened this issue 3 years ago • 0 comments

Hello,

First of all, thank you for this project. It's realy nice having the AWS SDK accessible from scalajs. I have an issue using the facade. I have spent several days on it and I don't understant what could be wrong. The code below is working well.

    val account = AWS.STS(aws_config)
    .getCallerIdentityFuture(GetCallerIdentityRequest()).onComplete({
      case Success(return_value) => {
        println(return_value.Account)
      }
      case Failure(e) => {
        e.printStackTrace()
      }
    })

It returns my AWS account number without any issue. But for my own comprehension, I have tried to go deeper using the alternative method below.

    val fun : scala.scalajs.js.Function2[facade.amazonaws.Error, facade.amazonaws.services.sts.GetCallerIdentityResponse, Unit] = (error: facade.amazonaws.Error, response: facade.amazonaws.services.sts.GetCallerIdentityResponse) => { println("bou"); println(response.getClass());println(error.getClass()) }
    val account3 = AWS.STS(aws_config).getCallerIdentity(GetCallerIdentityRequest()).on("complete", fun  ).send()

I am enable to return anything with the above code. The callback parameter are like this :

ERROR_TYPE : null
RESPONSE_TYPE : class java.lang.Void

I don't understand. Am I doing any obvious mistake ?

My environment :

Scala : 3.1.2
ScalaJS :
- addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
- addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")
AWS SDK facade : libraryDependencies += "net.exoego" % "aws-sdk-scalajs-facade_sjs1_2.13" % "0.33.0-v2.892.0",
AWS SDK : Compile / npmDependencies += "aws-sdk" -> "2.892.0",

Thank you for your help.

Best regards,

David Duquesne

dduquesne avatar Jun 25 '22 10:06 dduquesne