Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"scala.MatchError: application/xml" when using alpakka-s3 #1222

Closed
vvlevykin opened this issue Jun 21, 2017 · 6 comments
Closed

"scala.MatchError: application/xml" when using alpakka-s3 #1222

vvlevykin opened this issue Jun 21, 2017 · 6 comments
Assignees
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted bug regression
Milestone

Comments

@vvlevykin
Copy link

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.

@jypma
Copy link
Member

jypma commented Jun 21, 2017

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 jypma added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted bug regression labels Jun 21, 2017
@jypma
Copy link
Member

jypma commented Jun 21, 2017

Originally introduced by #1141 .

@jypma jypma self-assigned this Jun 22, 2017
jypma added a commit to jypma/akka-http that referenced this issue Jun 22, 2017
…ypeRange

This scenario was overlooked in akka#1141, because jm.ContentType isn't a
sealed trait (and can't be, because it is implemented in the scala DSL).

Fixes akka#1222.
@2m 2m closed this as completed in #1223 Jun 22, 2017
2m pushed a commit that referenced this issue Jun 22, 2017
…ange (#1223)

This scenario was overlooked in #1141, because jm.ContentType isn't a
sealed trait (and can't be, because it is implemented in the scala DSL).

Fixes #1222.
@2m 2m added this to the 10.0.9 milestone Jun 22, 2017
@2m
Copy link
Member

2m commented Jun 22, 2017

@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.

@jypma
Copy link
Member

jypma commented Jun 22, 2017

@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.

@timothyklim
Copy link

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?

@ktoso
Copy link
Member

ktoso commented Jun 26, 2017

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

jrudolph added a commit to jrudolph/akka-http that referenced this issue Jun 26, 2017
tomrf1 pushed a commit to tomrf1/akka-http that referenced this issue Aug 13, 2017
…ypeRange (akka#1223)

This scenario was overlooked in akka#1141, because jm.ContentType isn't a
sealed trait (and can't be, because it is implemented in the scala DSL).

Fixes akka#1222.
tomrf1 pushed a commit to tomrf1/akka-http that referenced this issue Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted bug regression
Projects
None yet
Development

No branches or pull requests

5 participants