Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Not Implemented exception when working with multipartCopy #176

Open
@oschrenk

Description

@oschrenk

I'm getting an Not Implemented exception when working with multipartCopy

Logs:

here1
21:34:45.910 [s3mock-akka.actor.default-dispatcher-12] ERROR io.findify.s3mock.S3Mock - method not implemented: HEAD http://localhost:8001/bucket/sourceKey
21:34:45.918 [s3mock-akka.actor.default-dispatcher-12] ERROR io.findify.s3mock.S3Mock - method not implemented: HEAD http://localhost:8001/bucket/sourceKey
21:34:45.922 [s3mock-akka.actor.default-dispatcher-12] ERROR io.findify.s3mock.S3Mock - method not implemented: HEAD http://localhost:8001/bucket/sourceKey
21:34:45.928 [s3mock-akka.actor.default-dispatcher-13] ERROR io.findify.s3mock.S3Mock - method not implemented: HEAD http://localhost:8001/bucket/sourceKey

akka.stream.alpakka.s3.S3Exception:  (Status code: 501 Not Implemented, Code: 501 Not Implemented, RequestId: -, Resource: -)
	at akka.stream.alpakka.s3.S3Exception$.apply(S3Exception.scala:73)
	at akka.stream.alpakka.s3.impl.S3Stream$.$anonfun$unmarshalError$1(S3Stream.scala:246)
	at scala.util.Success.map(Try.scala:262)
	at scala.concurrent.Future.$anonfun$map$1(Future.scala:240)
	at akka.http.scaladsl.util.FastFuture$FulfilledFuture.transform(FastFuture.scala:83)
	at scala.concurrent.Future.map(Future.scala:240)
	at scala.concurrent.Future.map$(Future.scala:240)
	at akka.http.scaladsl.util.FastFuture$FulfilledFuture.map(FastFuture.scala:76)
	at akka.stream.alpakka.s3.impl.S3Stream$.unmarshalError(S3Stream.scala:245)
	at akka.stream.alpakka.s3.impl.S3Stream$.$anonfun$getObjectMetadata$2(S3Stream.scala:237)
	at akka.stream.impl.fusing.Map$$anon$1.onPush(Ops.scala:53)
	at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
	at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:495)
	at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:390)
	at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
	at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:502)
	at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600)
	at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:769)
	at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$shortCircuitBatch(ActorGraphInterpreter.scala:759)
	at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:785)
	at akka.actor.Actor.aroundReceive(Actor.scala:537)
	at akka.actor.Actor.aroundReceive$(Actor.scala:535)
	at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:691)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:577)
	at akka.actor.ActorCell.invoke(ActorCell.scala:547)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
	at akka.dispatch.Mailbox.run(Mailbox.scala:231)
	at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

The code

  private val config = ConfigFactory.parseMap(
    Map(
      "alpakka.s3.proxy.host"                        -> "localhost",
      "alpakka.s3.proxy.port"                        -> 8001,
      "alpakka.s3.proxy.secure"                      -> false,
      "alpakka.s3.path-style-access"                 -> true,
      "alpakka.s3.aws.credentials.provider"          -> "static",
      "alpakka.s3.aws.credentials.access-key-id"     -> "foo",
      "alpakka.s3.aws.credentials.secret-access-key" -> "bar",
      "alpakka.s3.aws.region.provider"               -> "static",
      "alpakka.s3.aws.region.default-region"         -> "us-east-1"
    ).asJava
  )



val sourceKey  = "sourceKey"
val userBucket = UUID.randomUUID().toString
val targetKey  = UUID.randomUUID().toString
val repo       = new S3RepoImpl(DataConfig)

val s: Future[String] = for {
  _ <- S3.makeBucket(userBucket)
  _ <-
    Source
      .single(ByteString("some data"))
      .runWith(
        S3.multipartUpload(DataConfig.bucket, sourceKey)
      )
  _ = println("here1")
  _ <- S3
     .multipartCopy(
      DataConfig.bucket,
      sourceKey,
      userBucket,
      targetKey
    )
    .run()
  _ = println("here2")
  download <-
    S3.download(userBucket, targetKey)
      .runWith(Sink.head)
      .flatMap(
        _.get._1.map(_.utf8String).runWith(Sink.head)
      )
  _ <- S3.deleteObject(userBucket, targetKey).runWith(Sink.ignore)
  _ <- S3.deleteObject(DataConfig.bucket, sourceKey).runWith(Sink.ignore)
    } yield download

With

"com.lightbend.akka" %% "akka-stream-alpakka-s3" % "2.0.2"
"com.typesafe.akka"  %% "akka-stream"            % "2.6.10"
"io.findify"         %% "s3mock"                 % "0.2.6"

sbt 1.4.4
Scala 2.13.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions