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

Unknown integer coding error #221

Open
ioleo opened this issue May 14, 2023 · 5 comments
Open

Unknown integer coding error #221

ioleo opened this issue May 14, 2023 · 5 comments

Comments

@ioleo
Copy link

ioleo commented May 14, 2023

In one of the responses I return a raw token:

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwMUgwRFFUOTA1UzJOMlI1Q0s3RDNLRzlaOSIsImlzcyI6ImtpcmluIiwiaWF0IjoxNjg0MDg4MzY2LCJleHAiOjE2ODQxNzQ3NjYsInJvbGVzIjpbImFjY2Vzc1Rva2VuIiwidXNlciIsImFkbWluIl0sInVzZXJJZCI6IjAxSDBESDZFN1hTUENQRDEyTU5WS0dKNFhOIn0.VDj6WivUEFZZPB_Z8kMnQJTR2S3AJDm7o_juxMvScwc

which for some reason, when deserializing on frontend, triggers this error:

DeserializerError(java.lang.IllegalArgumentException: Unknown integer coding)

Experimenting a little, I think this is because the string is so long. By trial and error I determined that a 127-characters long string is OK, anything larger triggers the error.

source

@ioleo
Copy link
Author

ioleo commented May 14, 2023

As a workaround, I'm doing rawToken.grouped(120).toList, the API then takes a List[String] instead, and on frontend side I do rawTokenParts.mkString. Works.

@ioleo
Copy link
Author

ioleo commented Jul 27, 2023

I got into the same issue again. This time I had:

case class UserView(
  // ...
  roles: List[String]
)

and users fetched from database had either user or admin roles (note: both short strings, shorter than 127 chars).
Yet I got the same deserializer error.

Trying other collections like Vector does not help either.

Any ideas what this might be? /cc @ochrons @japgolly

@ioleo
Copy link
Author

ioleo commented Aug 6, 2023

I wonder why readInt gets invoked when my case class does not have any Int fields?

/cc @cquiroz

@ioleo ioleo changed the title Error serializing long strings Unknown integer coding error Aug 6, 2023
@japgolly
Copy link
Collaborator

japgolly commented Aug 6, 2023

I don't have much to add to this. I've used boopickle a lot with property tests (which generates massive strings) and I've never seen it fail. If you could provide a reproduction, a failing test case, that would really help.

I wonder why readInt gets invoked when my case class does not have any Int fields?

Encoders for other formats will serialise ints. Eg. string length and list length.

@cornerman
Copy link
Contributor

I got into the same issue again. This time I had:

Usually, I have seen these kind of errors, when the wrong codec is used for decoding in the frontend. Like, you might be returning an error message in the backend and the frontend wants to decode it as a success. Do you have more logs for these events? Or can you somehow reproduce it in a contained example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants