/dev vs /exec documentation and mishandling

扶醉桌前 提交于 2020-07-16 05:51:08

问题


Let's start with the fact that there isn't much documentation on /dev vs /exec. If you have some valuable info I can't find, I would totally love to see it, no sarcasm.

From what I can find, dev is the current editing version, and exec is the last published version of your scripts (or an older version if you so choose). This tells me I should be able to edit my standalone web app scripts without worrying about whether it breaks things for the users, because if it isn't published, they don't see the change. Except... this isn't actually the case.

Very easy to duplicate, just make a new web app, and put a console.log("Anything you want"), in the doGet function. Publish and run, and you will see your log in the console, awesome! Now go back, remove the console line, do not publish, and run it again. Your console output will no longer run, which it should have, because you didn't publish.

So my question is, where is the documentation on how this actually should function, because with the limited info I've been able to find, it appears broken.


回答1:


Answer:

The exec URL is the current published version of your Web App, whereas the dev URL runs the most recently saved code and can only be accessed by users who have edit access.

More Information:

From the documentation on Web Apps:

Once you click Deploy, you'll see a new dialog with a message indicating that your project has been successfully deployed as a web app.

This dialog provides two important URLs for your app:

The first is labeled Current web app URL and ends in /exec. This URL is for the published version of your app, based on the last version you saved and deployed.

The second is the link labeled latest code and ends in /dev. This URL can only be accessed by users who have edit access to the script. This instance of the app always runs the most recently saved code — not necessarily a formal version — and is intended for quick testing during development.

You can share the web app URL with those you would like to use your app, provided you have granted them access.

Be Aware:

The ID of the web app URL for /exec and /dev endpoints are not the same.

You can see this by viewing the Web App deloyment modal - the URL provided in the Current web app URL section is the /exec URL and the link provided in the Test web app for your latest code. string is the /dev URL. Note the IDs before the final / are not equivalent.

I hope this is helpful to you!

Reference:

  • Web Apps | Apps Script | Google Developers


来源:https://stackoverflow.com/questions/62045820/dev-vs-exec-documentation-and-mishandling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!