How about granting the script full access privileges (as well as any subscripts)?
I would be reluctant to use PSOS from a CWP-initiated script. Instead, I would have two scripts. The script itself, called by CWP, and another that calls it using PSOS (for FMP clients). You could, of course, combine this into one script using If to direct the script calling.
Do you have Allow User Abort[Off]? That may handle the time out issue.
You can do some robust error checking (after each step that could trigger an error, check and log).
My first thought was to grant all of the scripts and sub-scripts full access privileges. That did not change anything. I have tried turning Allow User Abort[off] and that does not work. Whenever I kick off the script normally (not PSOS), it hangs the browser and fails to return. Running with PSOS, it does not hang.
I have done extensive data logging with error checking. The errors I am seeing are related to privileges. Granting anything short of FULL ACCESS to the CWP user fails.
The scripts in question are not very complex, either. They parse the data inserted in the CWP interface (JSON packages) and create the appropriate records in several tables.
Followup: It looks like my scripts that are initiated through custom web publishing require, for whatever reason, Access via FileMaker Network (fmapp) enabled in order to work. Any rhyme or reason for this?
Is there more than one file involved here? Are there External Data Sources?
No, only one file involved. At least I can minimize the exposure to something less than [Full Access] until I figure out why...