Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queued points not clearing after successful post #166

Open
gloriouslyawkwardlife opened this issue Oct 18, 2024 · 4 comments
Open

Queued points not clearing after successful post #166

gloriouslyawkwardlife opened this issue Oct 18, 2024 · 4 comments

Comments

@gloriouslyawkwardlife
Copy link

I have set up a Google Apps Script to receive the output from the Overland app and create a JSON file in my Google Drive. While the execution is successful and returning the expected { "result": "ok"}, the queued locations are not being cleared after the post.

The script:

function doPost(e) {
  DriveApp.createFile(`${new Date().toISOString()}.overland.json`,e.postData.contents,'application/json');
  var reply = ContentService.createTextOutput();
  reply.append(
    `{
  "result": "ok"
}`);
  return reply;
}
@aaronpk
Copy link
Owner

aaronpk commented Oct 18, 2024

Do you have any way to tell how long this script takes to return the success response? I haven't set any timeouts on the http client and I don't know what the default is, but my guess is it's timing out before the app gets the response.

@gloriouslyawkwardlife
Copy link
Author

gloriouslyawkwardlife commented Oct 18, 2024

In the Apps Script Executions log it's showing 2.246s for 7,444 queued locations, 1.267s when there were about 4,500. Google Apps Script always returns an HTTP 200 even if there is an error in the script (the response would be an HTML page indicating the error), so I have turned on the "Consider HTTP 2XX Successful" setting.

Screenshot 2024-10-18 at 9 12 05 AM
(The errors were due to a typo in the script, which I corrected.)

I can confirm that the payloads are getting through (see the attached screenshot); but the app isn't clearing the queue afterward.

Screenshot 2024-10-18 at 9 08 13 AM

If it helps I am on iOS 18.0.1 on an iPhone 16 Pro Max (1 TB).

I have the same issue when sending it to a CouchDB endpoint as well (CouchDB accepts a simple JSON POST and returns a 200 with the ID of the created record).

@gloriouslyawkwardlife
Copy link
Author

gloriouslyawkwardlife commented Oct 18, 2024

UPDATE: I changed the URL to my CouchDB endpoint (which takes a raw JSON payload) and it worked; I saw the queue count drop and a record write to the database. It appears to be something with Google Apps Script.

For what it's worth, I believe GAS does an HTTP redirect to present the response; could the app possibly not be following the redirect?

@aaronpk
Copy link
Owner

aaronpk commented Oct 18, 2024

Yes, an HTTP redirect means it's first returning a non 200 HTTP code, which the app considers a failure then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants