Unable to run the view query

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #163916

    Hello,

    I am trying to use the fullsync in a project. But I have this C8oException when I try to call a view from my front end project : “Unable to run the view query”

    I did the pullAndPushData so my couchDb database already has the documents. When I execute the view in the convertigo studio it gives me the expected result.

    This is how I call my view from the front end project (using the angular sdk but not the C8oCaf) :

    return this.c8o.callJsonObject('fs://my_project_fullsync.view', {
    				"ddoc": 'Design_document',
    				"view": "Domains",
    				"__live": true
    			})
                            .async()
    			.then((response: any) => {
    				console.log(response);
    			})
                            .catch((err) => {
    				Promise.reject(err);
    			});

    Is there a particular reason why this error appears ?

    Thank you

    #163917

    Update :

    I don’t know if it’s related to the problem but it seems that the function to map the view isn’t updated in the couchDb database.

    My function in convertigo studio :

    
    function (doc) {
    	try {
    	    if(doc.domain != undefined){
    		emit(doc.domain.idDomain, doc.domain);
    	    }
    	} catch (err) {
    		log(err.message);
    	}
    }

    and in the couchDb (I imagine it’s the base function) :

    function (doc) {
    	try {
    		emit(doc._id, doc._rev);
    	} catch (err) {
    		log(err.message);
    	}
    }
    #163918

    Gregory Vorbe
    Moderator

    Hello Etienne,

    Do you execute the front end client on the same machine as your Studio or is it on a mobile device?
    When you change view map function and save your project it should update the couchDB view too, unless project does not use the same couchDB server when in Studio or deployed.
    Does your couchDB server needs authentication or is it set in Admin fest?

    QA&Support

    #163919

    I execute the front end client in the same machine as my studio. We use a convertigo server in a VM linked to a couchDB database. The couchDb server doesn’t need an authentication.

    I restart the server via the administration console after each modification saved in the studio.

    It’s strange because when I add a view in the convertigo studio, the couchb database get the new view but not the right map function.

    #163920

    Gregory Vorbe
    Moderator

    return this.c8o.callJsonObject('fs://my_project_fullsync.view', {...
    This executes the couchdb query locally on the client, and the message “Unable to run the view query” occurs when the local couchdb view on the front client is not present.
    The view is not present locally if you didn’t sync it with the couchdb server, something like:

    this.c8o.callJson("fs://.sync", "continuous", true)
                .then((response :any)=>{
                    return this.c8o.callJsonObject('fs://my_project_fullsync.view', {
                        "ddoc": 'Design_document',
                        "view": "Domains",
                        "__live": true
                    })
                          
                })...

    But I still can not explain why the map function is not updated on the couchdb server side, that’s strange.
    What tool are you using to connect to the CouchDB server?
    What is “pullAndPushData” you are mentioning in your first post?

    QA&Support

    #163921

    Ok, I forgot the sync. But by doing it I got another error :

    “Failed to process the fullsync request”.

    The pullAndPushData is the sequence I use to get the data from the prostgre database and do a PostBulkDocuments to push it to the couchdbDatabase. Sorry I didn’t explain it.

    We use vagrant to create the VM with the convertigo server and the couchDB server.

    #163922

    Gregory Vorbe
    Moderator

    This new error indicates that the front client can not access the couchDB server to synchronize with it.
    Would it be possible to perform a live session so you show us your environment?
    If yes, i’ll send you an invitation in PM.

    QA&Support

    #163923

    Okay, so it would be the access to the couchDB Server. I’ll check that on my side and come back to you tomorrow if there is still a problem.

    Thank you

    #163924

    Hello,

    I have more details about this error. When we try to sync, an http request OPTIONS is sent with a 405 error : Method not allowed.

    #163925

    Gregory Vorbe
    Moderator

    Hi,

    Changes were made with fullsync synchronize method in the SDK (OPTIONS request) and it requires Convertigo Studio/Server 7.4.6 to fully support it.

    QA&Support

    #163926

    Unfortunatly we will deploy to a Convertigo server 7.4.4… with no possibility to upgrade.

    Do you have a workaround / patch allowing us to use this functionnality?

    #163944

    Okay, the client is upgrading to 7.4.6 so I was able to test with this version.

    The synchronisation works, the database is replicated locally.

    Now is there a way to know what parameters are mandatory in the calls to the local database ? (get, view, post,…) because I always have the c8oException “incorrect number of parameters” (the first function I sent you in this post for example) and I can”t find it in the official doc https://www.convertigo.com/document/latest/reference-manual/convertigo-full-sync-architecture/interacting-locally-with-the-data/

    #163945

    admin
    Keymaster

    Hello for a view query the required parameters are:

    – ddoc
    – view

    All the others are optional.

    You can have more information about views here:
    http://docs.couchdb.org/en/1.6.1/couchapp/views/intro.html

    Hope That Helps
    Convertigo Support Team.

    #163948

    So, is there a reason why I get the “incorrect number of parameters” error for this function ?

    return this.c8o.callJsonObject('fs://my_project_fullsync.view', {
    				"ddoc": 'Design_document',
    				"view": "Domains",
    				"__live": true
    			})
                            .async()
    			.then((response: any) => {
    				console.log(response);
    			})
                            .catch((err) => {
    				Promise.reject(err);
    			});
    #163949

    Gregory Vorbe
    Moderator

    Hello Etienne,

    Here is what i wrote in my sample project:

    this.c8o.callJson("fs://.sync", "continuous", true)
            .then((response :any)=>{
                return this.c8o.callJsonObject('fs://.view', {
                    "ddoc": 'Design_document',
                    "view": "Domains",
                    "__live": true
                })
                      
            })
            .async()
            .then((resp:any)=>{
                this.c8o.log.debug(JSON.stringify(resp));
                return null;
            })
            .catch((err)=>{
                this.c8o.log.error("error", err);
            });

    The “incorrect number of parameters” may occurs in the sync call if you do not provide pair parameters.

    QA&Support

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.