https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
apollo-kotlin
  • l

    louiscad

    09/09/2021, 10:38 AM
    Hello, since apollo-android is not just for Android, I'd like it to be renamed to apollo-kotlin If you agree, would you please take 7 seconds to add a 👍🏼 on this issue, or even add a comment to weigh in? https://github.com/apollographql/apollo-android/issues/3317
    ➕ 4
    w
    f
    m
    • 4
    • 9
  • w

    wasyl

    09/09/2021, 1:11 PM
    Is it possible to have strict runtime validation to check: • that the
    __typename
    field matches the expected type name from schema • that the json response doesn’t contain unnecessary fields/objects ?
    m
    • 2
    • 19
  • s

    Slackbot

    09/10/2021, 8:27 PM
    This message was deleted.
    m
    i
    • 3
    • 6
  • j

    james

    09/13/2021, 1:21 AM
    apollo 2.x.x had
    clearNormalizedCache
    function available on ApolloClient, how do you perform this with apollo3?
    m
    • 2
    • 4
  • p

    Pulkit

    09/13/2021, 6:55 PM
    Hey folks, while running UI test cases, I wanted to mock the data coming from graphQL. Our implementation is
    val response = ApolloGraphQL.getClient().query(RandomQuery()).await()
    Here the response will be of data type RandomQuery.Data , which is a data class. Is it possible I can add fake data and mock the response here? I see in the generated class (RandomQuery.Data class), there is a function, which parses the data somehow
    operator fun invoke(reader: ResponseReader)
    w
    • 2
    • 1
  • m

    Matt Kula

    09/20/2021, 9:01 PM
    Found the issue here. Looks like it was fixed in kotlin v1.5.30
    👍 2
    i
    • 2
    • 1
  • w

    wasyl

    09/21/2021, 1:34 PM
    I wonder if anyone has any thoughts about migrations in Apollo. We’re using the normalized cache extensively, and the app relies on some data being available immediately, even if it’s not entirely up-to-date. This all works fine as long as we don’t modify the query for that data, but once we do, we have a cache miss and reach out to the network. That’s fine, but sometimes that initial request takes time or fails, and we end up with no data at all. I’m thinking about implementing some kind of migration, where the app would be made aware of new fields added for some objects, and it would manually save some default data in the cache. That way we’d avoid a cache miss if a field was added and the device is e.g. offline. Does that make any sense?
    m
    • 2
    • 4
  • n

    Nick

    09/28/2021, 3:36 PM
    Hi again! I just starting moving some graphql’s to it’s own module. This module will perform the request, then return the response to the
    app
    module. I’m getting this error. I’d rather not have to append a !! or any special null checks to this if possible. I’m using version Apollo version
    2.5.9
    m
    • 2
    • 10
  • w

    wasyl

    09/30/2021, 1:08 PM
    lazy bug report: I had a query
    SomefooQuery
    with generated Kotlin classes. I renamed it to
    SomeFooQuery
    , and
    compileKotlin
    failed with
    Redeclaration: SomeFooQuery
    and
    Redeclaration: SomefooQuery
    errors. Seems like the lowercase file was kept and shouldn’t,
    --rerun-tasks
    fixed the issue
    👀 1
    m
    • 2
    • 12
  • s

    Scott Kruse

    10/05/2021, 4:54 PM
    Does Apollo for multiplatform generate your queries for you? reading here: https://www.apollographql.com/docs/android/essentials/get-started-multiplatform/
    🧵 1
    e
    m
    • 3
    • 17
  • d

    david.bilik

    10/19/2021, 10:44 AM
    Hey, i’m trying to upload a file through
    SingleUploadMutation
    but the
    FileUpload
    class does not accept a
    File
    as stated in docs but accepts only a
    filePath: String
    and if i check the
    FileUpload
    class there is no implementation 🤔 is the documentation not updated or am I missing something?
    b
    • 2
    • 2
  • m

    Maria Sharkina

    10/19/2021, 4:36 PM
    Morning all. Can someone share how your developers experience look like in term of schema downloading? I am interested in where do you download the schema (Apollo Studio, your servers or something else), at what point of the dev lifecycle schema is uploaded, and when and by whom it is downloaded. Anything you can share regards how useful it is greatly appreciated. I am trying to figure out what would be the smoothest process for us, taking into account that this step never existed before.
    w
    d
    m
    • 4
    • 5
  • s

    Seb Jachec

    10/21/2021, 12:54 PM
    Hi all! Does anyone have any pointers on caching? I'm trying to cache & re-use the output of a query for multiple items for another query for a single item (going from a list of items to a detail screen for one). Using 3.0.0-alpha07 with a normalized cache. Simplified sample below I've changed the cache key format for an 'entry' to
    Entry.<id>
    using `ObjectIdGenerator`/`CacheKeyResolver` but I'm getting a cache miss for
    EntryQuery
    –
    Object 'QUERY_ROOT' has no field named 'entry({"input":{...}})'
    , before the inner
    Entry
    from
    EntryOutput
    can even be looked up in the cache (which I'd expect to succeed)
    type Entry {
    	id: ID!
    	# ... etc
    }
    
    query EntriesQuery(...) {
    	entries(input: { ... }) { # produces EntriesOutput
    		nodes { # [Entry]
    			id
    		}
    	}
    }
    
    query EntryQuery($entryId: ID!) {
    	entry(input: { entryId: $entryId }) { # produces EntryOutput
    		entry { # Entry
    			id
    		}
    	} 
    }
    m
    • 2
    • 32
  • n

    Nick

    10/21/2021, 7:32 PM
    In Apollo 2, you could react to changes to the cache. What’s the best way to do this with Apollo3? Is it:
    apolloClient.watch(MyQuery())
    ?
    :yes: 1
    m
    • 2
    • 4
  • m

    Milan Vadhel

    10/22/2021, 11:35 AM
    Hello Everyone Is there any way to handle exception handling by only one class in GraphQL like an interceptor in REST Api?
    j
    b
    • 3
    • 8
  • j

    Jeremie

    10/22/2021, 3:08 PM
    hellow everyone, Im writing an app using apollo3 (early stage of development) and the example I based myself on handles one call fine but as soon as I start calling many it ends up crashing. does anyone have a good example from github that uses apollo 3 and is able to do multiple calls to the server in parallel? Im having a hard time sifting through.
    m
    • 2
    • 6
  • j

    Jeremie

    10/25/2021, 4:44 PM
    hmmmm can't find how to set retries in apollo3? 🤔
    m
    u
    • 3
    • 8
  • n

    Nick

    10/27/2021, 2:07 PM
    I’m in the process of converting to apollo3 (using beta 1). I added a
    service
    . When I build it, I get the following error:
    Could not determine the dependencies of task ':app:generateServiceApolloSources'.
    > Could not resolve all task dependencies for configuration ':app:apolloServiceConsumer'.
       > No variants of project :graphql-model match the consumer attributes:
           - Configuration ':graphql-model:default':
               - Incompatible because this component declares a runtime of a component and the consumer needed a usage of 'apollo-metadata' of a component
               - Other compatible attribute:
                   - Doesn't say anything about com.apollographql.service (required 'service')
    m
    • 2
    • 8
  • n

    Nick

    11/02/2021, 9:56 PM
    Does
    watch
    also perform a network request if it’s not already in the cache?
    apolloClient.watch(BookWithAuthorName()).collect { response ->
          // This will be called every time the book or author changes
      }
    m
    • 2
    • 7
  • n

    Nick

    11/03/2021, 7:05 PM
    Is there a way to make a query load from the cache, then perform a network request, then continue to monitor the cache for changes?
    m
    w
    • 3
    • 30
  • j

    Jeremie

    11/04/2021, 2:23 PM
    Using fragments: is there a way to put the fragment at the root at the object?
    //graphql 
    query myQuery {
        rootObject {
            ...On RootObjectA {
               ... myFragment
           }
        }
    }
    
    fragment myFragment on RootObjectA {
       id
       name
    }
    //Kotlin object gets structured like this:
    
    rootObject.fragments.myFragment.id
    // What Id like to see:
    
    rootObject.id.  // or rootObject.fragments.id if `fragments` are required because of the casting from the ON function
    m
    • 2
    • 14
  • s

    Seb Jachec

    11/04/2021, 4:45 PM
    Does anyone know if there's an equivalent API to
    refetchQueries
    (to trigger the refetch of a given query following a mutation) in 3.x? Never used this before, but I can see references to the feature searching the Github repo, which I assume are 2.x. Can't work out if there's something I've missed for 3.x
    m
    • 2
    • 4
  • n

    Neal Sanche

    11/04/2021, 4:55 PM
    I had recently updated to 3.0.0-beta01, and today updated my dependencies to 3.0.0-beta02 and nothing compiles anymore. I must be missing something. I get a lot of things like:
    ApolloRequest<GetUserQuery.Data> but Query<TypeVariable(D)> was expected
    and
    Unresolved reference: hasErrors
    and a bunch more like this. I'll keep looking.
    m
    b
    • 3
    • 26
  • n

    Neal Sanche

    11/04/2021, 10:09 PM
    Ran into a strange networking issue. We have our network transport set up as follows:
    val networkTransport = HttpNetworkTransport(
            connectTimeoutMillis = 5_000,
            readTimeoutMillis = 60_000,
            serverUrl = "${config.serverUrl}/graphql",
            interceptors = listOf(
                BearerTokenInterceptor(tokenProvider = object :
                    com.apollographql.apollo3.network.http.TokenProvider {
                    override suspend fun currentToken(): String {
                        return config.tokenProvider.currentToken()
                    }
    
                    override suspend fun refreshToken(previousToken: String): String {
                        return config.tokenProvider.refreshToken(previousToken)
                    }
                })
            )
        )
    Specifically note the connect timeout, which differs from the default 60 seconds. This used to work on Android and iOS until migrating to the 3.0.0beta builds. What we discovered today was a particular call, which we know takes a bit over 30 seconds, was failing on iOS, however most of the other mutations we have succeeded. So we tried changing the connectTimeout to 60_000 instead, and that succeeded. I haven't verified, but suspect, this means that the iOS networking call might be using connect timeout instead of read timeout, or something like that. Just thought I'd report it here. Can also report on the github if preferred.
    👀 1
    m
    • 2
    • 6
  • r

    rocketraman

    11/11/2021, 6:27 PM
    Getting a lot of errors like this from:
    okhttp3.OkHttpClient - A connection to <https://example.com/> was leaked. Did you forget to close a response body?
    I'm using 2.5.9, and apollo-runtime is the only user of okhttp3, except that I have
    com.squareup.okhttp3:logging-interceptor
    enabled. Is there anything in particular I should look for in my code that might be causing this?
    m
    • 2
    • 10
  • n

    Neal Sanche

    11/17/2021, 9:32 AM
    We had a strange, transient (I have no evidence of this), issue with a mutation yesterday that seemed to be cached and had overrun the maximum field length of the cache. We cleared the app data, and the issue went away. I read the documentation in the code and it says that mutations use a fetch policy of
    NETWORK_ONLY
    , so it seems strange that the sqlite cache would be used at all for any of this. I'll update to the latest beta and see if we see it again.
    m
    w
    • 3
    • 15
  • v

    Vitaliy Kondratiev

    11/22/2021, 3:03 PM
    Hey guys. Starting to work with apollo3 and KMM. I'm wondering why this is an assertion during execution
    assertMainThreadOnNative()
    if I'm trying to execute a query. Why am I forced to do it on the main thread?
    m
    • 2
    • 6
  • m

    mbonnin

    12/07/2021, 7:14 PM
    Hi everyone 👋 . We just released `3.0.0-rc01`🎉 : • Changelog • Documentation • Migration Guide If everything goes well, we're planning to go stable next week 🤞. In a nutshell, Apollo Android 3 brings: • a 100% Kotlin codebase, using coroutines APIs and KMP support • a new (optional) codegen that maps the Json response 1:1 and models fragments as interfaces • declarative cache with
    @typePolicy
    • client-side non-nullability with
    @nonnull
    • a test builder DSL • SQLite batching and many more performance improvements • AST and lower level primitives to manipulate your queries If you haven't already, now is a good time to look at it and offer feedback. Changing things will be way harder once all the APIs are all frozen like a Kotlin native StableRef using the old memory model 🙃 . Feel free to reach out here or on Github!
    🔥 5
    🎉 9
    👍 2
    • 1
    • 2
  • m

    mateusz.kwiecinski

    12/14/2021, 8:44 PM
    👋 I want to manually modify Apollo cache state. 2.x exposed
    ApolloStore#writeAndPublish
    which required query and query data only. 3.x exposes
    ApolloStore#writeOperation
    but in my scenario it also requires passing
    customScalarAdapters: CustomScalarAdapters
    (to properly handle passed data object) Is there any way to access
    customScalarAdapters
    set previously on
    ApolloClient
    instance?
    👋 1
    m
    • 2
    • 17
  • s

    Stylianos Gakis

    12/15/2021, 8:27 AM
    Is there no more .logger function on the builder in 3.0? Is there an alternative or should it be done manually somehow? I didn’t see this being mentioned in the migration logs, a bit lost here.
    m
    • 2
    • 7
Powered by Linen
Title
s

Stylianos Gakis

12/15/2021, 8:27 AM
Is there no more .logger function on the builder in 3.0? Is there an alternative or should it be done manually somehow? I didn’t see this being mentioned in the migration logs, a bit lost here.
m

mbonnin

12/15/2021, 8:30 AM
That's correct. The rationale is that logs are not very structured and you can use interceptors to get the same information in a more structured way
We'll add that to the migration guide
If you're looking at logging the cache misses (this was one of the main use cases), you can register an interceptor that logs
CacheMissException
s

Stylianos Gakis

12/15/2021, 8:49 AM
With this context it sounds reasonable, and I understand the rationale. Since this was such a deliberate decision, imo it’s super important to be on the migration guide, for sure. Thanks for the clarification!
m

mbonnin

12/15/2021, 10:31 AM
PR to add a helper function to log cache misses https://github.com/apollographql/apollo-kotlin/pull/3724
😍 1
s

Stylianos Gakis

12/15/2021, 12:12 PM
Wow that was fast, thanks so much!
m

mbonnin

12/15/2021, 12:15 PM
Thank you for reporting this 🙂 !
View count: 15