Getting warning "The document could not be saved. Please check connection settings"

I am getting the below error while opening a document in OnlyOffice editor :

I checked the logs but there was nothing much other than this line which was repeated several times -

sendServerRequest returned an error: data = "{“error”:0}"

Kindly help me out and let me know how to get rid of this warning which prompts up every time I open the document.

I have read many related questions and none of them have worked for me yet.

hi @Devyansh

If you have valid license, then I’d recommend contacting us via Zendesk to get prompt replies:
https://onlyofficesupport.zendesk.com/

Are you trying to do integration?
Describe your situation in more detail.

Please specify the following information::

  • OS where your Document Server installed,
  • Type of installation (Docker, EXE, DEB/RPM)
  • Please send me the Log folder of the Document Server :

Linux: /var/log/onlyoffice/documentserver/

Windows: C:\Program Files\ONLYOFFICE\DocumentServer\Logs

Docker: inside the Document Server’ container: /var/log/onlyoffice/documentserver/ or on the host machine if it is mapped : /app/onlyoffice/DocumentServer/logs

  • Please send a screenshot of your browser’s console while opening any document via ONLYOFFICE editor:

"Open the spreadsheet editor => open developer tools in the browser (F12 in Chrome/Firefox) => refresh the page and make a screenshot that I can see Console and Network tabs.

Hi, I got the same problem when I try to integrate with Django

I am working on an EDM with Django. To understand OnlyOffice, I downloaded the ‘Python Example’ version and configured it correctly with Docker. However, when I run it, I get an error message: “The document cannot be saved. Please check connection settings.” Yet, the test version with Docker alone works correctly. Besides this issue, I receive the same message when I integrate it with Django.

  1. Here below when I was trying to integrate onlyoffice without the Python Example but got the same error :slight_smile:

from django.shortcuts import render, get_object_or_404
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
import datetime
import jwt
from .models import Document
from django.conf import settings
import json

def document_list(request):
documents = Document.objects.all()
return render(request, ‘document_list.html’, {‘documents’: documents})

def get_onlyoffice_secret():
return settings.ONLYOFFICE_JWT_SECRET

def generate_onlyoffice_token(payload):
secret = get_onlyoffice_secret()
return jwt.encode(payload, secret, algorithm=‘HS256’)

def open_docx(request, document_id):
document = get_object_or_404(Document, id=document_id)

# Utilisation de request.build_absolute_uri pour s'assurer que l'URL est complète
file_url = request.build_absolute_uri(document.file.url)
print(f"File URL: {file_url}")  # Ajouter cette ligne pour vérifier l'URL

document_payload = {
    "fileType": document.file.path.split('.')[-1],
    "key": str(document.id),
    "title": document.title,
    "url": file_url,
}

editor_config = {
    "mode": "edit",
    "callbackUrl": request.build_absolute_uri(f'/documents/callback/{document.id}/')
}

print(f"Callback URL: {request.build_absolute_uri(f'/documents/callback/{document.id}/')}")

payload = {
    "type": "desktop",
    "document": document_payload,
    "editorConfig": editor_config,
    "exp": datetime.datetime.utcnow() + datetime.timedelta(hours=1)
}

token = generate_onlyoffice_token(payload)

config = {
    "type": "desktop",
    "document": document_payload,
    "editorConfig": editor_config,
    "token": token
}

context = {
    "edit_url": f"{settings.ONLYOFFICE_SERVER_URL}/web-apps/apps/api/documents/api.js",
    "config": config
}

return render(request, 'edit_docx.html', context)

@csrf_exempt
def onlyoffice_callback(request, document_id):
if request.method == ‘POST’:

Traitez les données de callback ici

data = json.loads(request.body.decode(‘utf-8’))
status = data.get(‘status’, 0)

    # Ajoutez votre logique pour traiter les différents statuts ici
    if status == 2:  # Document Saved
        # Sauvegardez le document
        pass
    return JsonResponse({"error": 0})
return JsonResponse({"error": 1})

Can you help to solve this error ? if possible for both cases.

Sure, here’s a refined version in plain English for a technical forum:


Hi @Meschaclbl :wave:

To start, let’s review how you’ve set up the Document Server in the Python example.

  1. Ensure Connectivity: The ONLYOFFICE Docs address must be reachable from Nextcloud, and the Nextcloud address must be reachable from ONLYOFFICE Docs.

  2. Configure Python Example: Follow the instructions provided here to configure your Python example: Configure the Python example.

  3. Check Document Server Logs: Please provide the logs from the Document Server located at: /var/log/onlyoffice/documentserver.

  4. Additional Help: You might find this post helpful as well: Java Spring Example Issue.