Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
joaogoncalves
Partner - Contributor III
Partner - Contributor III

Sense Mashup - Invalid Visualization: Extension not found in server

Hello all! I have a issue with extensions using mashups in another server. Everything is working fine except the extensions. The extension shows "invalid visualization - The visualization not found in the server". When using by single-object, or the html is running in the SENSE server works fine, but i wanna put it fully embedded in my website. Can anyone help me please?error.png

/*

* Basic responsive mashup template

* @owner Enter you name here (xxx)

*/

/*

*    Fill in host and port for Qlik engine

*/

/*var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );

var config = {

    host: window.location.hostname,

    prefix: prefix,

    port: window.location.port,

    isSecure: window.location.protocol === "https:"

};

require.config( {

    baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"

} );

*/

var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);

var config = {

    //host: window.location.hostname,

    host: "[SERVER]",

    //prefix: prefix,

    prefix: "/webticketos/",

    port: window.location.port,

    isSecure: true

};

//require.config({

//baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"

//  baseUrl: "https://[SERVER]:443/webticketos/resources"

//});

requirejs.config({

    config: {

        text: { useXhr: function(url, protocol, hostname, port) { return true; } }

    },

    baseUrl: "https://[SERVER]:443/webticketos/resources"

});

define("client.services/grid-service", {});

require(["js/qlik"], function(qlik) {

    qlik.setOnError(function(error) {

        $('#popupText').append(error.message + "<br>");

        $('#popup').fadeIn(1000);

    });

    $("#closePopup").click(function() {

        $('#popup').hide();

    });

    //callbacks -- inserted here --

    //open apps -- inserted here --

    var app = qlik.openApp('bb029934-f1c6-490f-8b47-b171eb44c558', config);

    //get objects -- inserted here --

    //create cubes and lists -- inserted here --

    app.getObject('QV01', 'LeWNjh');

    app.getObject('QV02', 'sXJCWE');

    app.getObject('QV03', 'VCdLwFn');

    app.getObject('QV04', 'hReQpJs');

    app.getObject('QV05', 'LHhjdFT');

    app.getObject('QV06', 'ZrApPL');

    //get objects -- inserted here --

});

17 Replies
joaogoncalves
Partner - Contributor III
Partner - Contributor III
Author

Yes, i've configured baseurl:

  1. requirejs.config({ 
  2.     config: { 
  3.         text: { useXhr: function(url, protocol, hostname, port) { return true; } } 
  4.     }, 
  5.     baseUrl: "https://[SERVER]:443/webticketos/resources" 
  6. });

In browser no errors. Only one ws request pending, and I don't know why.

Anonymous
Not applicable

No expert on these things, but is your server / dns name really called [SERVER], or have you posted name that to keep the real name secret.

pathiqvd
Creator III
Creator III

Hi,

Correct or wrong I don't know    Try this,


var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );

var config = {

host: window.location.hostname,

prefix: prefix,

port: window.location.port,

isSecure: window.location.protocol === "https:"

};

require.config( {

baseUrl: ( config.isSecure ? "https://" : "http://" ) +

config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"

} );

require( ["js/qlik"], function ( qlik ) {

qlik.setOnError( function ( error ) {

$( '#popupText' ).append( error.message + "<br>" );

if ( !control ) {

control = true;

$( '#popup' ).delay( 1000 ).fadeIn( 1000 ).delay( 11000 ).fadeOut( 1000 );

}

} );

var app = qlik.openApp('46842aa9-4e2a-46e2-835b-72bd070ae160', config);

joaogoncalves
Partner - Contributor III
Partner - Contributor III
Author

I've tried without success.

var config = {

host: window.location.hostname, //here, since we running the script in a diferente server, host variable becames the IIS server, instead of qlik sense server. In that case, every visualization became unavailable.

prefix: prefix,

port: window.location.port,

Francis_Kabinoff
Former Employee
Former Employee

There are 3 things you should consider.

First, if you add the path to "qlik" in your "paths" in your require config, that'll fix some extensions. Hopefully, this is enough to make it work, and you don't have to consider anything else.


require.config({

  "baseUrl": (config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "" ) + config.prefix + "resources",

  "paths": {

    "qlik": (config.isSecure ? "https://" : "http://" ) + config.host + config.prefix + "resources/js/qlik"

  }

});

If that doesn't work, check if your qlik sense server is on https, and your mashup is on http, if so, extensions will often not load from the qlik sense server. As far as I know, if this is your problem, there is no way around this. What you could do instead is register the extension on the fly Registering extensions on the fly.

If adding "qlik" to paths doesn't fix it, and you're not trying to serve assets from an https Qlik Sense to http server, it may be a problem specific to the extension. For instance, if something in the extension is trying to load any assets relative to the server, and expects to be on the same domain as the Qlik Sense server, it won't be able to find those assets. In this case, you'd have to make edits to the extension to address that. And often if I have to do this, I also register the extension on the fly, keeping the mashup specific modified copy with the mashup.

joaogoncalves
Partner - Contributor III
Partner - Contributor III
Author

Hi Francis,

First of all thank you for you time. Unfortunately adding "qlik" to paths doesn't fix it and as far as I understood, register extensions on the fly is not an option for us. The extensions are complex and require multiple .js files in multiple folders.


Do you know if there is someway possible to make the Qlik Sense extensions working with qlik sense already registered(and working) extensions? Seems like when we make a request to Qlik Sense the extension folder that js expect is from IIS server, instead of qlik sense server.

Once again, thank you for your time and availability.

Kind Regards,

João Gonçalves

Francis_Kabinoff
Former Employee
Former Employee

It depends on the extension code itself. If the extension is loading stuff with require.js, then it should load ok because it will use the baseUrl in the require config. But if the extension is trying to load relative assets outside of require.js, then obviously being on a different server will affect the relative path. You'd have to check out each particular extension to see what's going on and adjust the code as necessary.

And an extension being complex and requiring multiple files shouldn't be a barrier to registering the extension on the fly. The extension almost certainly has a single entry point. You would just serve the entire extension folder containing all of the contents, and register the single entry point.

joaogoncalves
Partner - Contributor III
Partner - Contributor III
Author

Thank you Francis,

I think in that case we have to use iframes for out use case. Once again thank you for your time and explanation.

Kind Regards,