Add On Permissions Issue

51 views
Skip to first unread message

cri...@gmail.com

unread,
May 5, 2019, 10:09:16 PM5/5/19
to Google Apps Script Community
I published an add-on to the Sheets Add-On store and when you go to install it, it simply shows a white box which then immediately disappears. My understanding is that this is the box that you would usually pick and account from and then give the appropriate permissions to. The add on never gets installed.

The add on is called Edit o Matic.

Any ideas on how to fix this? I'm assuming that this is an issue on Google's end?

Thanks!

aj.addons

unread,
May 5, 2019, 11:24:19 PM5/5/19
to Google Apps Script Community
I tried to install your add-on from Chrome, and I can confirm that the dialog flashes on the screen momentarily and then disappears.  I don't know what the problem is, but I'd probably start with the "onInstall()" event trigger.  There could be something wrong with that.  Are you using any global variables?  Apps Script doesn't like global variables in some situations.  Can we see your onInstall() function?

Romain Vialard

unread,
May 6, 2019, 4:40:29 AM5/6/19
to Google Apps Script Community

cri...@gmail.com

unread,
May 6, 2019, 6:56:46 AM5/6/19
to Google Apps Script Community
function on install(e){
onOpen(e);
}

cri...@gmail.com

unread,
May 6, 2019, 7:25:31 AM5/6/19
to Google Apps Script Community
There are no Stackdriver errors, and the logs are empty... 

aj.addons

unread,
May 6, 2019, 7:57:25 AM5/6/19
to Google Apps Script Community
Does your actual code have a space?  Or did you post code here that is different that what you are actually using?

You posted:
on install(e)

Must be: 
onInstall(e)

Make sure that onInstall(e) is at the very top of code.gs
Don't assign values to any global variables in the global scope.

The next step would be to debug your onOpen(e) function.

On Monday, May 6, 2019 at 6:56:46 AM UTC-4, cri...@gmail.com wrote:
function on install(e){
onOpen(e);
}

cri...@gmail.com

unread,
May 6, 2019, 10:38:06 AM5/6/19
to Google Apps Script Community
Here’s the exact code:

function onInstall(e) {
onOpen(e);
}

function onOpen() {
// Add a custom menu to the spreadsheet.
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Edit o Matic')
.addItem('Short Link Setup','oneTimeSetup')
.addItem('Get Long & Short Form Edit URLs', 'EditFormURLs')
.addItem('Get Long Form Edit URLs', 'LongFormURLs')
.addToUi();
}

aj.addons

unread,
May 6, 2019, 11:21:04 AM5/6/19
to Google Apps Script Community
I'm not saying that this is causing the problem, but you don't need to use the event object "e"  You aren't using it for anything, so it's pointless to capture it.

function onInstall() {//dont use "e"
  onOpen();
}

Also, you should have an add-on menu.  But that's probably not causing the problem either.

I'd put the one time set up in the add-on menu.

function onOpen() {
  // Add a add-on menu to the spreadsheet.
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createAddonMenu('Edit o Matic')
      .addItem('Short Link Setup','oneTimeSetup')
      .addToUi();

  // Add a custom menu to the spreadsheet.
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Edit o Matic')
      .addItem('Get Long & Short Form Edit URLs', 'EditFormURLs')
      .addItem('Get Long Form Edit URLs', 'LongFormURLs')
      .addToUi(); 
}

But those things probably aren't causing the error.  There is probably an "uncaught" error in your code.  "Uncaught" meaning that when you save the code, test the code, and publish the code, that the error isn't being found, but when it's installed, there is an error.

You still haven't told me whether you have global variables or not.

cri...@gmail.com

unread,
May 6, 2019, 8:02:49 PM5/6/19
to google-apps-sc...@googlegroups.com
I'm not using Global Variables, and I removed the (e) and there is no change.

I also published the add-on with the changes you suggested:

function onInstall() {
  onOpen();
}

function onOpen() {
  // Add a custom menu to the spreadsheet.
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createAddonMenu('Edit o Matic')
      .addItem('Short Link Setup','oneTimeSetup')
      .addItem('Get Long & Short Form Edit URLs', 'EditFormURLs')
      .addItem('Get Long Form Edit URLs', 'LongFormURLs')
      .addToUi();  
}

None of these things have made a difference. 

As I see it, the rest of the code is irrelevant, it shouldn't be running the rest of the code? 

I am using a library, but I'm assuming that you can do that as an add-on. 

Thanks for your help!
Message has been deleted

Alan Wells

unread,
May 6, 2019, 8:16:55 PM5/6/19
to google-apps-sc...@googlegroups.com
Remove permissions to the script that you are using for development.  Navigate to:
Apps with access to your account
By going to your account settings - security:
Then scroll down to
Third-party apps with account access
Remove the permissions to the apps script project that you use for development.
Test the add-on and see if you get a prompt to re-authorize the script.
From the code editor, choose VIEW, EXECUTION TRANSCRIPT
And look for whether there was an error or not.
I don't have the exact answer for what steps to take to find your problem, but you need to go through a process of elimination to narrow down what it might be.  I don't know if the problem is your script file, or something with the publishing process.  So, the first thing to do is try to narrow down what might be going wrong in your code.

On Mon, May 6, 2019 at 8:02 PM <cri...@gmail.com> wrote:
I'm not using Global Variables, and I removed the (e) and there is no change.

I also published the add-on with the changes you suggested:

function onInstall() {
  onOpen();
}

function onOpen() {
  // Add a custom menu to the spreadsheet.
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createAddonMenu('Edit o Matic')
      .addItem('Short Link Setup','oneTimeSetup')
      .addItem('Get Long & Short Form Edit URLs', 'EditFormURLs')
      .addItem('Get Long Form Edit URLs', 'LongFormURLs')
      .addToUi();  
}



--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/d2065b6f-d113-413f-9dd6-a54c60457c62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

cri...@gmail.com

unread,
May 6, 2019, 8:42:59 PM5/6/19
to Google Apps Script Community
I think that I figured it out...

The line: .createAddonMenu('Edit o Matic')

Should read: .createAddonMenu()

As the menu name is pulled from the deployed add on name....



To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.

Chris Webb

unread,
May 7, 2019, 7:12:44 PM5/7/19
to Google Apps Script Community
I just wanted to say thank you so much for helping me out with this. It's working now

Alan Wells

unread,
May 7, 2019, 7:18:15 PM5/7/19
to Google Apps Script Community
I'm glad it's working.  I'm wondering if using try/catch would have helped to debug the problem.

Chris Webb

unread,
May 7, 2019, 10:00:26 PM5/7/19
to google-apps-sc...@googlegroups.com
Nope, it was down to the fact that I had named the add on menu when it should have been blank. It doesn't throw an error.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages