Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connector works in simulator but hangs in Tableau #109

Closed
mbatchkarov opened this issue Aug 22, 2016 · 3 comments
Closed

Connector works in simulator but hangs in Tableau #109

mbatchkarov opened this issue Aug 22, 2016 · 3 comments
Assignees

Comments

@mbatchkarov
Copy link

I've got a connector that streams data from REST API. It works as expected in the provided simulator . When I load the connector into Tableau 10, I go through the credentials page successfully and then I get stuck at this page:

screen shot 2016-08-22 at 11 09 04

Clicking cancel results in the following being displayed indefinitely:

screen shot 2016-08-22 at 11 09 57

I have to kill Tableau to get out of this screen. The connector file is hosted on a remote server (I couldn't find a way to point Tableau to a local file), while Tableau and the data API are running on localhost for dev purposes. The connector code is

(function (){
    var myConnector = tableau.makeConnector();

    setupConnector = function (){
        tableau.connectionData = {server: "http://127.0.0.1:8081", token: "hello"};
        tableau.connectionName = server + token.substring(0, 5);
    };

    myConnector.getSchema = function (schemaCallback){
        var params = tableau.connectionData;
        var cols = [];
        var apiURL = params.server + "/api/component?target=schema&access_token=" + params.token;

        $.getJSON(apiURL, function (resp){
            cols.push({
                    'id': 'hello',
                    'alias': 'alias',
                    'dataType': tableau.dataTypeEnum.int
                });
        }).success(function (){
            var tableInfo = {
                id: "Data Feed",
                alias: "Read data from API",
                columns: cols
            };

            schemaCallback([tableInfo]);
        });
    };

    myConnector.getData = function (table, doneCallback){
        var params = tableau.connectionData;
        var apiURL = params.server + "/api/component?access_token=" + params.token;

        var getMoreData = function (){
            $.getJSON(apiURL, function (resp){
                if (resp == "Come back later"){
                    doneCallback();
                }
                else{
                    if (!resp.length){
                        console.info("No new data has been fetched.");
                    }
                    table.appendRows(resp);
                    getMoreData();
                }
            });
        }

        getMoreData();

    };

    tableau.registerConnector(myConnector);

    $(document).ready(function (){
        $("#submitButton").click(function (){
            setupConnector();
            tableau.submit();
        });
    });
})();
@mbatchkarov mbatchkarov changed the title Connector works in simulators but hangs in Tableau Connector works in simulator but hangs in Tableau Aug 22, 2016
@lbrendanl
Copy link
Contributor

Hey @mbatchkarov do you get any errors in the console when running this in the simulator?

@mbatchkarov
Copy link
Author

Turns out the problem is with partially with the remote API, which returns 404 (as I've misspelt the URL). That appears to be what causes Tableau to hang. However, no errors are reported in the Tableau log. I'll have a look at the simulator log too, but IIRC there is nothing there either.

@lbrendanl
Copy link
Contributor

Closing for lack of activity, please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants