1

Working on developing an updatable apple wallet pass, I've progressed to the point of sending a push notification to update my pass.

While trying to stop updating a pass based on the passesUpdatedSince from the following get request

app
  .route(
    "/pass/v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier"
  )
  .get(async (req, res) => {
    const { deviceLibraryIdentifier, passTypeIdentifier } = req.params;
    const { passesUpdatedSince } = req.query;
    const lastUpdated = <get lastUpdated>;
    const updatedRequired = parseInt(passesUpdatedSince) < lastUpdated;

    if (!updatedRequired) {
      console.log("no updates");
      return res.status(204).send();
    }

    <get serialNumbers>

    return res
      .set({ "Content-Type": "application/json" })
      .status(200)
      .send({
        serialNumbers,
        lastUpdated
      });
  });

When I respond with a status 204, the following error log is returned

  '[2022-07-19 18:07:32 +0800] Get serial #s task (for device<deviceID>, pass type <passID>, last updated 1658224105; with web service url <webServiceUrl>) encountered error: Server response was malformed (The data couldn’t be read because it isn’t in the correct format.)'

I've looked through the documentation, and it doesn't say that I need to return any data when responding with a 204 status. The error log keeps getting sent until I delete the pass.

Any suggestions on how to fix this?

Jason Lee
  • 11
  • 2
  • If the client expects the format `{serialNumbers, lastUpdated}`, you could send 200 OK with `{"serialNumbers": [], "lastUpdated": []}` rather than 204 No Content. – Heiko Theißen Jul 19 '22 at 11:26
  • @HeikoTheißen, tried doing that but the pass keeps coming back to call on the get request above and it turn into an infinite loop albeit a slow one. – Jason Lee Jul 19 '22 at 14:06

0 Answers0