Synchronization of iOS clients leads to error “Network request failed”

Operating system

Linux

Joplin version

3.3.3

Desktop version info

Joplin Mobile 13.2.5 (prod, ios)

Client-ID: f74dd716eac84455971e0857830880f1
Sync-Version: 3
Profil-Version: 47
Unterstützter Schlüsselbund: Nein

Revision: 2fba10133 (dev)

iOS-Version: 18.3.1
FTS aktiviert: 1
Hermes aktiviert: 1

Sync target

Joplin Server

What issue do you have?

I have the problem that all my Windows clients are successfully synchronized with my Joplin server but all my iOS clients fail to synchronize with the error “Network request failed”.
In the complete error log from iOS clients, the following error is displayed:

03-02T13:06:35: ShareService: Maintenance: Failed to update share invitations: TypeError: Network request failed
TypeError: Network request failed
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:17840:33)
    at apply (native)
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14593:26)
    at _callTimer (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14514:17)
    at callTimers (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14712:19)
    at apply (native)
    at __callFunction (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3622:38)
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3429:31)
    at __guard (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3555:15)
    at callFunctionReturnFlushedQueue (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3428:21)
03-02T13:06:35: JoplinServerApi: curl -v -X POST -H "X-API-MIN-VERSION: 2.6.0" -H "Content-Type: application/json" -H "Content-Length: 124" --data '{"email":"alex@test.org","password":"******","platform":5,"type":2,"version":"13.2.5"}' 'https://joplin.myowndomain.org/api/sessions'
03-02T13:06:35: JoplinServerApi: Code: <undefined>
03-02T13:06:35: JoplinServerApi: TypeError: Network request failed
TypeError: Network request failed
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:17840:33)
    at apply (native)
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14593:26)
    at _callTimer (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14514:17)
    at callTimers (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14712:19)
    at apply (native)
    at __callFunction (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3622:38)
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3429:31)
    at __guard (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3555:15)
    at callFunctionReturnFlushedQueue (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3428:21)
03-02T13:06:35: JoplinServerApi: Could not acquire session: <undefined> 
 TypeError: Network request failed
TypeError: Network request failed
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:17840:33)
    at apply (native)
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14593:26)
    at _callTimer (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14514:17)
    at callTimers (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:14712:19)
    at apply (native)
    at __callFunction (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3622:38)
    at anonymous (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3429:31)
    at __guard (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3555:15)
    at callFunctionReturnFlushedQueue (/Users/laurent/Library/Developer/Xcode/DerivedData/Joplin-ewsyxzklwwggmtdeyavpfmrkhqhv/Build/Intermediates.noindex/ArchiveIntermediates/Joplin/BuildProductsPath/Release-iphoneos/main.jsbundle:3428:21)

I am running a Joplin server version 3.3.3 as a docker container with the following docker compose:

version: '3'
services:
  joplin-db:
    image: postgres:16-alpine
    container_name: joplin-db
    hostname: joplin-db
    restart: unless-stopped
    volumes:
      - /volume1/docker/joplin/postgres/data:/var/lib/postgresql/data
      - /etc/TZ:/etc/TZ:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - 5432
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=xxx
      - POSTGRES_DB=joplin
    networks:
      - joplin-net
  joplin-app:
    image: joplin/server:latest
    container_name: joplin-app
    hostname: joplin-app
    restart: unless-stopped
    depends_on:
      - joplin-db
    expose:
      - 22300
    environment:
      - APP_PORT=22300
      - APP_BASE_URL=https://joplin.myowndomain.org
      - DB_CLIENT=pg
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=xxx
      - POSTGRES_DATABASE=joplin
      - POSTGRES_PORT=5432
      - POSTGRES_HOST=joplin-db
    volumes:
      - /etc/TZ:/etc/TZ:ro
      - /etc/localtime:/etc/localtime:ro
    networks:
      - joplin-net
networks:
  joplin-net:
    external: true

In front of the Joplin server is a proxy Nginx Proxy Manager (NPM) in version 2.12.3, also as a docker container.
The Joplin server container and NPM container use the same network.

I have made the following proxy hosts settings in NPM for the Joplin server:

In the tab "Details":

  • Scheme: http
  • Forward hostname / IP: joplin-app
  • Forward port: 2230
  • Cache Assets: True
  • Block Common Exploits: True
  • Websockets Support: True

In the tab "Custom locations":

nothing added

In the tab "SSL":

  • SSL Certificate: *.myowndomain.org
  • Force SSL: True
  • HSTS Enabled: True
  • HTTP/2 Support: True
  • HSTS Subdomains: True

In the tab "Advanced" under "Custom Nginx Configuration":

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;

The certificate used was correctly issued by the internal ACME client of the NPM for my domain by Lets Encrypt.
The same certificate is also successfully used for other proxy hosts in NPM.

I used the following setting in the iOS Joplin app settings in version 13.2.5 on my iOS clients with iOS 18.3.1:

When I call up the url https://joplin.myowndomain.org/api/ping in the Safari browser on the same iOS device, I get the following message:

{"status":"ok","message":"Joplin Server is running"}

Since the Safari browser does not display any certificate message, I would assume that my TLS certificate is issued and used correctly.

I hope you have a good idea what my problem with the configuration could be. If I had to guess, I suspect a configuration problem in the NPM.

It seems that I have found the answer to my problem myself. In the post Joplin iOS app does not sync in Joplin Server - #10 by PeBa it was explained that you have to set the switch to True in the iOS settings under Privacy & security -> Local Network -> Joplin. After I made the settings on my iOS devices, the synchronization works perfectly.