Akka-http: "scala.MatchError: application/xml" when using alpakka-s3

Created on 21 Jun 2017  路  6Comments  路  Source: akka/akka-http

Versions:

  • Akka: 2.5.3
  • Akka-HTTP: 10.0.8
  • Alpakka-s3: 0.9

I'm trying to upload a stream using alpakka-s3 and getting an error:

scala.MatchError: application/xml (of class akka.http.scaladsl.model.ContentType$WithMissingCharset)
        at akka.http.scaladsl.model.ContentTypeRange.matches(ContentType.scala:17)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$EnhancedFromEntityUnmarshaller$.$anonfun$forContentTypes$4(Unmarshaller.scala:112)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$EnhancedFromEntityUnmarshaller$.$anonfun$forContentTypes$4$adapted(Unmarshaller.scala:112)
        at scala.collection.IndexedSeqOptimized.prefixLengthImpl(IndexedSeqOptimized.scala:37)
        at scala.collection.IndexedSeqOptimized.exists(IndexedSeqOptimized.scala:45)
        at scala.collection.IndexedSeqOptimized.exists$(IndexedSeqOptimized.scala:45)
        at scala.collection.mutable.WrappedArray.exists(WrappedArray.scala:38)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$EnhancedFromEntityUnmarshaller$.$anonfun$forContentTypes$3(Unmarshaller.scala:112)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$$anon$1.apply(Unmarshaller.scala:58)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$EnhancedUnmarshaller$.$anonfun$mapWithInput$3(Unmarshaller.scala:91)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$$anon$1.apply(Unmarshaller.scala:58)
        at akka.http.scaladsl.unmarshalling.Unmarshaller.$anonfun$transform$3(Unmarshaller.scala:23)
        at akka.http.scaladsl.unmarshalling.Unmarshaller$$anon$1.apply(Unmarshaller.scala:58)
        at akka.http.scaladsl.unmarshalling.Unmarshal.to(Unmarshal.scala:25)
        at akka.stream.alpakka.s3.impl.S3Stream.$anonfun$signAndGetAs$2(S3Stream.scala:242)
        at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:302)
        at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
        at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
        at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
        at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:38)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

There is no error with Akka-HTTP <10.0.8.

bug 1 - triaged regression

Most helpful comment

@TimothyKlim Yes, we'll be releasing a fixed version very soon

All 6 comments

This is caused by jm.ContentType not being a sealed trait, and hence not causing any compiler warnings. Someone ought to try to make that a sealed trait, so we can squash all warnings.

@jypma thanks for a quick fix. How often do you think this is going to be an issue with 10.0.8? We should decide when to release 10.0.9 according to this.

@2m The issue shows every time the akka-http-xml unmarshaller hits a content-type of application/xml (without charset). Hard to say how often that is; apparently it's true for S3, maybe other APIs do that as well.

We've problems with all xml webhooks after upgrade to 10.0.8. Is there any plans to release 10.0.9 soon with that hotfix?

@TimothyKlim Yes, we'll be releasing a fixed version very soon

Was this page helpful?
0 / 5 - 0 ratings