Steven,
The error message you are seeing, CloudSubmit: Cloud Server is not able to complete a request is often an internal server error (HTTP status 500) on the Wolfram Cloud server.
The fact that the task runs fine manually confirms your code is correct, but something is failing during the execution phase of the scheduled task. Issues with a ScheduledTask are often due to permissions, resources, or timeouts.
The Core Issue 1: Permissions and External APIs
Your code involves two crucial external network operations:
a) Fetching Data
Import[HTTPRequest["XXXX", ...]]
b) Uploading the Map
URLExecute[HTTPRequest["XXXX", ...]]
Scheduled tasks may not inherit the same execution permissions as your interactive session, which can cause these external network calls to fail.
Solution: Explicitly Enable External Network Access
When deploying the ScheduledTask, you must ensure that external network access is explicitly enabled using the Permissions option. While this is often implicitly handled in a manual session, it can be required for scheduled execution.
task = ScheduledTask[(... your task code ...), "Daily", TimeZone -> "America/New_York"];
CloudDeploy[task,
Permissions -> "Public",
AutoRemove -> False,
Method -> {"ExternalNetwork", "Trusted"} (* <-- **CRITICAL CHANGE** *)
]
Adding Method -> {"ExternalNetwork", "Trusted"} is the most critical troubleshooting step to add to your CloudDeploy call.
It tells the cloud server that this task is trusted and allowed to make outbound network calls, which is essential for HTTPRequest and URLExecute.
Possible Issue 2: Timeouts and Resource Limits
Scheduled tasks are subject to stricter memory and time limits than interactive sessions. If your initial HTTPRequest or the subsequent GeoListPlot processing takes too long, the task could be terminated silently, leading to the server error.
Solution: Increase Timeout for HTTP Calls
Add a generous Timeout setting to your HTTPRequest to ensure that the task kernel is waiting long enough for the external API to respond:
csv = Import[
HTTPRequest[
"XXXX",
<|
Method -> "POST",
"Body" -> <| ... |>
|>
],
"Dataset",
Timeout -> 60 (* Increase timeout to 60 seconds *)
];
Possible Issue 3: Server Instability
Since the error is server-side, you can try to isolate the deployment from the code execution by deploying a simple "wrapper" function instead of the raw ScheduledTask.
Solution: Deploy a Wrapper Function as a Workaround
A) Save the main logic as a Cloud Function:
Create a separate, simple function that performs the action and deploy it first.
cloudAction = CloudDeploy[
Function[{dt},
(* ALL of your complex code goes here, but use 'dt' instead of
DateObject[Yesterday, ...] *)
],
"MyDailyMapUpdater",
Permissions -> "Public"
]
B) Schedule the wrapper
Create a simpler ScheduledTask that just calls the deployed function.
CloudDeploy[
ScheduledTask[
cloudAction[DateObject[Yesterday, TimeZone -> "America/New_York"]],
"Daily",
TimeZone -> "America/New_York"
],
Permissions -> "Public",
Method -> {"ExternalNetwork", "Trusted"} (* Still needed for the main function *)
]
Hope this helps!