Repository navigation
Sync error #1361
Copy link
Copy link
Closed
Description
Priority/Impact
No response
Description
Description
[Please describe what you were doing when the error occurred.]
Error details
Error title: Sync error
Error message: Exception: Failed to fetch token
Sync status:
server: self-hosted
connected: false, connecting: false, downloading: false, uploading: false
last successful sync: 2026-08-26T19:54:22.624Z
pending uploads: 1
checkpoint request: target 9223372036854775807, seen -, applied -
local buckets: last op 560166, ops since checkpoint 25000, oplog rows 9936
error (Uncategorised): Exception: Failed to fetch token
App logs (last 23 entries):
2026-09-11T16:11:10.813477Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 3 (1233ms), reason: status code 500
2026-09-11T16:11:10.732536Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-gym/, attempt 3 (1223ms), reason: status code 500
2026-09-11T16:11:10.641081Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 3 (1229ms), reason: status code 500
2026-09-11T16:11:08.929536Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 2 (542ms), reason: status code 500
2026-09-11T16:11:08.821955Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-gym/, attempt 2 (551ms), reason: status code 500
2026-09-11T16:11:08.765608Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 2 (569ms), reason: status code 500
2026-09-11T16:11:07.335576Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 1 (307ms), reason: status code 500
2026-09-11T16:11:07.334605Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-gym/, attempt 1 (276ms), reason: status code 500
2026-09-11T16:11:07.332340Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 1 (293ms), reason: status code 500
2026-09-11T16:11:06.904863Z WARNING [powersync-django] Upload deferred: Upload of UpdateType.patch on core_userprofile deferred: retryable status 500
2026-09-11T16:11:02.808488Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 3 (1146ms), reason: status code 500
2026-09-11T16:11:02.806672Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 3 (1090ms), reason: status code 500
2026-09-11T16:11:02.706137Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-gym/, attempt 3 (1188ms), reason: status code 500
2026-09-11T16:11:01.161443Z WARNING [powersync-django] Upload deferred: Upload of UpdateType.patch on core_userprofile deferred: retryable status 500
2026-09-11T16:11:01.160441Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 2 (602ms), reason: status code 500
2026-09-11T16:11:01.160125Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-gym/, attempt 2 (561ms), reason: status code 500
2026-09-11T16:11:01.158683Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 2 (546ms), reason: status code 500
2026-09-11T16:10:59.879438Z INFO [powersync] Connecting to the sync service (manual retry)
2026-09-11T16:10:59.680834Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 1 (257ms), reason: status code 500
2026-09-11T16:10:59.674816Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 1 (252ms), reason: status code 500
2026-09-11T16:10:59.667999Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-gym/, attempt 1 (260ms), reason: status code 500
2026-09-11T16:10:58.024082Z WARNING [powersync-django] Upload deferred: Upload of UpdateType.patch on core_userprofile deferred: retryable status 500
2026-09-11T16:10:56.074364Z INFO [WgerBaseProvider] Retrying fetch for https://gym.xxx.ddns.net/api/v2/routine/14/structure/, attempt 3 (1114ms), reason: status code 500
Server version
No response
Mobile app version
2.1.0+270 on android, installed by com.android.vending
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
rolandgeider commentedon Sep 27, 2026
Hi! This looks like a server problem, all the requests return a server error, e.g.
https://gym.xxx.ddns.net/api/v2/routine/14/date-sequence-display/, attempt 1 (257ms), reason: status code 500is there anything in the docker logs for the web service?
Sanji78 commentedon Sep 27, 2026
Which docker logs shall I inspect?
rolandgeider commentedon Sep 27, 2026
the
webservice, it's the one producing the server errorsSanji78 commentedon Sep 28, 2026
" django.db.utils.ProgrammingError: column core_userprofile.time_zone does not exist" I dunno if this is the root cause... in powersynch I have: " user_profile:
auto_subscribe: true
queries:
- SELECT * FROM core_userprofile WHERE CAST(user_id AS TEXT) = auth.user_id()
- SELECT * FROM gallery_image WHERE CAST(user_id AS TEXT) = auth.user_id()"
Sanji78 commentedon Sep 28, 2026
I fixed it :)
rolandgeider commentedon Sep 28, 2026
yes that was the problem!
you probably had
DJANGO_PERFORM_MIGRATIONSset to false in the config, in that case you need to take care of these things yourself :)Sanji78 commentedon Sep 28, 2026
I still have issue in logging in ..
Error message: ClientException with SocketException: Failed host lookup: 'gym.XXX' (OS Error: No address associated with hostname, errno = 7), uri=https://gym.XXX/sync/sync/stream Sync status: server: self-hosted connected: true, connecting: false, downloading: true, uploading: false last successful sync: 2026-08-26T19:54:22.624Z pending uploads: 0 checkpoint request: target 1, seen -, applied - local buckets: last op 793226, ops since checkpoint 258050, oplog rows 10212 download progress: 258050 / 258287 error (Connection error): ClientException with SocketException: Failed host lookup: 'gym.XXX' (OS Error: No address associated with hostname, errno = 7), uri=https://gym.XXX/sync/sync/stream App logs (last 26 entries): 2026-09-28T07:54:54.152145Z FINE [AuthNotifier] revalidation: session still valid 2026-09-28T07:54:54.095079Z WARNING [ServerGating] serverUpdateRequired: could not parse server version "2.8.0-dev.0" (sanitized: "2.8.0-"), skipping check 2026-09-28T07:54:53.376563Z FINE [AuthNotifier] refreshAccessToken: success, new expiry 2026-09-28 07:59:53.000Z, rotated refresh token: true 2026-09-28T07:54:52.654976Z FINE [AuthNotifier] revalidation: access token within leeway, refreshing first 2026-09-28T07:54:52.654877Z FINE [AuthNotifier] revalidation: app resumed with stale access token 2026-09-28T07:54:52.615642Z FINE [AuthHttpClient] Pre-emptive refresh: access token within leeway window 2026-09-28T07:54:52.615612Z FINER [TrophyStateNotifier] Fetching user trophy progression 2026-09-28T07:54:52.615568Z FINE [AuthHttpClient] Pre-emptive refresh: access token within leeway window 2026-09-28T07:54:52.615472Z FINER [TrophyStateNotifier] Fetching user trophies 2026-09-28T07:54:52.614698Z FINE [AuthNotifier] refreshAccessToken: starting 2026-09-28T07:54:52.614590Z FINE [AuthHttpClient] Pre-emptive refresh: access token within leeway window 2026-09-28T07:54:52.614256Z FINER [TrophyStateNotifier] Fetching trophies 2026-09-28T07:54:52.613134Z INFO [NetworkStatus] Network status: online (probe answered) 2026-09-28T07:54:52.520621Z FINE [PowerSync] Credentials: PowerSyncCredentials<endpoint: https://gym.XXX/sync/ userId: 7 expiresAt: 2026-09-28 07:59:48.450629Z> (repeated 19x since last logged) 2026-09-28T07:51:58.122813Z INFO [NetworkStatus] Network status: offline (probe failed: ClientException with SocketException: Failed host lookup: 'gym.XXX' (OS Error: No address associated with hostname, errno = 7), uri=https://gym.XXX/api/v2/version/) 2026-09-28T07:51:28.599358Z WARNING [PowerSync] Sync error: Sync service error (repeated 19x since last logged) | ClientException with SocketException: Failed host lookup: 'gym.XXX' (OS Error: No address associated with hostname, errno = 7), uri=https://gym.XXX/sync/sync/stream #0 IOClient.send (package:http/src/io_client.dart:227) #1 StreamingSyncImplementation._postStreamRequest (package:powersync/src/sync/streaming_sync.dart:332) #2 streamFromFutureAwaitInCancellation. (package:powersync/src/sync/stream_utils.dart:142) 2026-09-28T07:51:25.401467Z FINER [TrophyStateNotifier] Fetching user trophy progression 2026-09-28T07:51:25.401291Z FINER [TrophyStateNotifier] Fetching user trophies 2026-09-28T07:51:25.400794Z FINER [TrophyStateNotifier] Fetching trophies 2026-09-28T07:51:25.398796Z INFO [NetworkStatus] Network status: online (network adapter available, probe pending) 2026-09-28T07:51:20.649376Z INFO [NetworkStatus] Network status: offline (probe failed: ClientException with SocketException: Failed host lookup: 'gym.XXX' (OS Error: No address associated with hostname, errno = 7), uri=https://gym.XXX/api/v2/version/) 2026-09-28T07:50:50.321712Z INFO [PowerSync] Starting Rust sync iteration (repeated 17x since last logged) 2026-09-28T07:49:48.450684Z FINE [PowerSync] Credentials: PowerSyncCredentials<endpoint: https://gym.XXX/sync/ userId: 7 expiresAt: 2026-09-28 07:59:48.450629Z> 2026-09-28T07:49:48.450322Z INFO [powersync-django] Connecting to PowerSync endpoint https://gym.XXX/sync/ 2026-09-28T07:49:48.221317Z FINE [AuthNotifier] refreshAccessToken: success, new expiry 2026-09-28 07:54:47.000Z, rotated refresh token: true 2026-09-28T07:49:47.423058Z FINE [AuthNotifier] refreshAccessToken: starting
Sanji78 commentedon Sep 28, 2026
Where should I add DJANGO_PERFORM_MIGRATIONS ? I don't have it anywhere...
rolandgeider commentedon Sep 28, 2026
it's in the default prod.env config, which one are you using?
Sanji78 commentedon Sep 28, 2026
This one
How can I fix the above error?
rolandgeider commentedon Sep 28, 2026
the one we provide has all the common (and possible) options, you can then just add one that has the specific overrides you need
As for the OS error, that sometimes happens in android when you put the app in the background and the OS cuts internet access. Does it sync correctly when you are using the app? (that being said, we should perhaps hide that specific error a bit)
Sanji78 commentedon Sep 28, 2026
After I patched the above, the sync started to work and download, but it never completes... now it's at 264791/265028 and it's stuck...
Sanji78 commentedon Sep 28, 2026
I compared your prod.env with mine and this is the result:
Any line I need to add?
rolandgeider commentedon Sep 28, 2026
if those are the options that are missing, then you should be set
As for why your sync doesn't finish (it seems it can't sync the last 237 entries), I have no idea. There's however a new version of both the flutter sdk and the docker image for the service, which from what I've seen from their issues at the very least have better logging. I'll try to push a new version of the app tomorrow or so, before we start searching for this in the logs like in the other issue
Sanji78 commentedon Sep 28, 2026
I added "proxy_buffering off;
proxy_request_buffering off;
proxy_set_header Connection '';
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;" to my ontop nginx proxy manager that routes the traffic to gym.xxxx and it fixed the issue. Now the app connects properly.
rolandgeider commentedon Oct 8, 2026
oh it was the buffering option! We definitely need to put this more prominently in the docs!!
(closing here, if you encounter further sync errors, just open a new issue)