This started happening lately. In FireFox, the links are opening ok, but in Chrome/Safari, after a quick loading sign, nothing happens.
In the console I see an error: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
Addon is written in Apps Script.
Example code that stopped working:
CardService.newActionResponseBuilder()
.setOpenLink(
CardService.newOpenLink().setUrl("https://sub.fulldomain.com/foo")
)
.build()
In the manifest:
...
"addOns": {
"common": {
"openLinkUrlPrefixes": [
"https://sub.fulldomain.com/"
],
...
}
Based on the info in the docs, that should have worked.
Also tried defining a wildcard "https://*.fulldomain.com/" and tried to define a full path. Still nothing works.
Update
Looks like the code that stopped working is specifically setOnClickOpenLinkAction that calls an action that builds the url to be open:
// In file X I build the card
const button = CardService.newTextButton()
.setText("click here")
.setTextButtonStyle(CardService.TextButtonStyle.FILLED)
.setOnClickOpenLinkAction(
CardService.newAction()
.setFunctionName("openLink")
.setParameters({ ...ourParams })
);
// ...
// In main I have the "openLink" function
export function openLink(event): ActionResponse {
const url = buildUrl(event.parameters);
return CardService.newActionResponseBuilder()
.setOpenLink(CardService.newOpenLink().setUrl(url))
.build();
}
Followed this example.
Question
How to make setOnClickOpenLinkAction work?
Workaround
The only workaround that worked for me, was to use setOpenLink directly on the button:
const button = CardService.newTextButton()
.setText("click here")
.setTextButtonStyle(CardService.TextButtonStyle.FILLED)
.setOpenLink(CardService.newOpenLink().setUrl(url))
My question is still the same tho, how to make setOnClickOpenLinkAction work?