But after changing the execution engine to V8 (same script, just some seconds later, no tinkering with deployments), I get this:
The second URL (V8), ending with /dev, is the private one useful while testing. I've tried with several different scripts and this behaviour seems consistent, at least on my side. Instructing the user of a document-bound AppsScript template to get into code editor > deploy to get the public URL is not that bad, but simple things like showing it programatically help reduce friction, IMO.
Any idea why this is happening? Bug or by design (for reasons beyond my understanding)? Any workaround for this? (using the Apps Script API to manage deployments is not an option).