App installation callback failures

Our app components based app uses the Asana documented method of rendering a button to close the popup window to signal installation success with the supplied js snippet:

window.opener.postMessage("success", "https://app.asana.com");
window.close();

We continue to have users for whom window opener is null, so they receive the error:
“Cannot read properties of null (reading ‘postMessage’)”

We have them try with different browsers and it doesn’t solve the issue for them. Is there a known workaround for this? In general, various browser extensions and settings seem to break this ‘signal success by closing a popup window’ mechanism, so if there’s an alternate mechanism we’d be happy to switch to it. Thx!

1 Like

Hi @pmatern,

Are you calling it within window.onload?

    window.onload = function () {
        window.opener.postMessage("success", "https://app.asana.com");
        window.close();
    };
1 Like

Hi @Phil_Seeman!
We’re actually using that snippet as the body of a function used as the click handler of a button:

Click here to finish the integration

Looks like the forum at my code snippet :slight_smile: but you get the idea

I don’t know why window.opener wouldn’t be available in a click handler, but I’d suggest you try it in the onload per my example - not to use as a solution, but just to confirm that it works there and then you can focus on why it’s null in the handler. If it doesn’t work in the onload then something else very odd is going on.

It turns out this issue is cropping up with folks using the Asana desktop app. Redirecting folks to add the app via the web circumvents the issue.

1 Like

Ahhh, OK, thanks @pmatern for posting that update - good to know for the future!

Hi Everyone,

Just wanted to give an update. We’ll be implementing a step in our app publishing process to allow apps to be installable on the desktop application.

2 Likes