When I run this script in Shortcuts, Run Script action hangs for around 10 seconds and fails with an alert:
Could not run Run Script
The operation took too long to complete. Please try again.
The same script works totally fine if I run it within Scriptable, or if I run it in Shortcuts via x-callback-url.
It looks like Shortcuts’ Run (Scriptable) Script action has some timeout and doesn’t know Scriptable script is completed.
I do have Script.complete() call at the end of my script, so I am not sure what’s happening here.
The async operation in my script shouldn’t take more than 5 seconds. In fact, if I run it with working methods described above, it takes only 2-3 seconds to complete.
Any idea what would be blocking the operation completion?
PS: Pasteboard.pasteString() is undefined if I run script in Shortcuts as well even though it has a value if I run it in Scriptable. Is this expected?