Unknown Custom Scalars during Apollo Client GraphQL 3.0 migration

Unknown Custom Scalars during Apollo Client GraphQL 3.0 migration


0

I have been following this link to do an apollo client version upgrade: https://www.apollographql.com/docs/kotlin/migration/3.0/

After completing the section to replace customTypeMapping I am now seeing the following error:

Apollo: unknown custom scalar(s) in customScalarsMapping: Date,Currency,Year,Month,Percentage,MediaType,Base64

My build.gradle.kts file has been updated to contain the updated custom scalar mapping methods:

    mapScalar("Date", "java.time.LocalDate")
    mapScalar("Currency", "java.util.Currency")
    mapScalar("Year", "java.time.Year")
    mapScalar("Month", "java.time.Month")
    mapScalar("Percentage", "kotlin.String")
    mapScalar("MediaType", "kotlin.String")
    mapScalar("Base64", "kotlin.String")
    mapScalar("JSON", "kotlin.String")

I don’t see any mention of this being an issue anywhere else. Why am I getting this error, and how can I get my custom mappings to work like before?

Share
Improve this question

1 Answer
1

Reset to default


0

Turns out apollo3 does not allow mapScalar of unused types, but apollo2 does. So in this case, I had to remove everything except the JSON mapping.

Share
Improve this answer



Leave a Reply

Your email address will not be published. Required fields are marked *