CardService button not opening URL in overlay

I have a button in my Google Sheets add-on that should open a form in an overlay window when clicked. The script runs without errors, but the overlay window never appears. I’ve checked my manifest file and it looks correct to me. Here’s my code:

function surveyForm() {
  var btn = CardService.newTextButton()
    .setText("Open Survey")
    .setOpenLink(CardService.newOpenLink()
      .setUrl("https://docs.google.com/forms/d/e/1FAIpQLSdExample123Form456/viewform")
      .setOpenAs(CardService.OpenAs.OVERLAY)
      .setOnClose(CardService.OnClose.RELOAD_ADD_ON));
}

And my manifest configuration:

{
  "timeZone": "America/New_York",
  "dependencies": {},
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "urlFetchWhitelist": ["https://docs.google.com/forms/d/e/1FAIpQLSdExample123Form456/viewform"],
  "openLinkUrlPrefixes": ["https://docs.google.com/forms/d/e/1FAIpQLSdExample123Form456/viewform"]
}

What am I missing here? Any ideas why the overlay isn’t showing up?

Had this exact problem last month - spent hours on it! Your overlay config looks fine, that’s not the issue. The real problem is your function creates the button but never returns it or attaches it to a card. You need to wrap that button in a card section and return the complete card structure. Also double-check you’re calling this from the right manifest trigger (onHomepageTrigger or onSelectionChange). Without the full card structure, the button doesn’t render in the UI, so clicks do nothing.

This is probably a browser security issue with Google Forms in overlays. I ran into the same thing building a workspace add-on last year. Google Forms blocks iframe embedding for security - that’s what overlay mode uses under the hood. Your manifest URL prefixes are fine, but the form won’t load in embedded contexts. Switch your OpenAs parameter to FULL_SIZE instead of OVERLAY. This opens in a new tab and should work fine. If you really need overlay functionality, build a custom HTML dialog with HtmlService rather than embedding the external form.

Make sure you’re actually calling surveyForm() somewhere in your code. Just creating the button won’t do anything - you need to add it to a card section and return that card from your trigger function. Also, try testing with something simple like google.com first to see if the overlay even works.