Closed chris-miner closed 2 years ago
Thank you for reporting this @chris-miner. We're looking into it and will get back to you.
To remedy the situation for myself, I commented out the relevant lines in node_modules/square/dist/square.cjs.development.js
:
var appointmentSegmentSchema = /*#__PURE__*/schema.object({
durationMinutes: ['duration_minutes', /*#__PURE__*/schema.number()],
// serviceVariationId: ['service_variation_id', /*#__PURE__*/schema.string()],
teamMemberId: ['team_member_id', /*#__PURE__*/schema.string()],
// serviceVariationVersion: ['service_variation_version', /*#__PURE__*/schema.bigint()],
intermissionMinutes: ['intermission_minutes', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.number())],
anyTeamMember: ['any_team_member', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.boolean())],
resourceIds: ['resource_ids', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.array( /*#__PURE__*/schema.string()))]
});
This was caused by a discrepancy between what the back end was actually returning and what the back end specified it would return. The fix was made on the back end and no SDK changes are necessary.
I did the following:
Expected:
Found:
Here's the whole error message:
Extra Info
As you can see the
service_variation_id
andservice_variation_version
aren't present. In this case I don't actually care since all I want to know about is times, dates, customer, staff, email, and phone info about the booking. The data in the system was put there via the appointments web interface, so I don't know why it is missing attributes.My workaround, is to correct the data, but that only works for 'bad' bookings that haven't been canceled. If they have been canceled I can't edit them through the UI.
My other idea is to fetch the bookings one by one rather than in batch mode so I can skip over the ones that are causing a problem. That won't work since the fetch fails in a way that doesn't allow me to continue with a subsequent fetch with a new cursor value.
Conclusions
It shouldn't bomb out the way it does, especially since I am not responsible for the integrity of that data. I'm just a consumer of it.