I have the following TS code (using the Airtable REST API)
export const updateInstanceQRCode = (instanceId: string, qrCodeUrl: string) => {
return base('Instance').update([
{
"id": instanceId,
"fields": {
"QR Code": [{
"url": qrCodeUrl
}]
},
},
]);
}
which works great when I am testing in development, but the moment I try to build the project, I get the following error:
> tsc -b && vite build
src/externalAPI/AirtableClient.tsx:127:21 - error TS2739: Type '{ url: string; }' is missing the following properties from type 'Attachment': id, filename, size, type
127 "QR Code": [{
~
128 "url": qrCodeUrl
~~~~~~~~~~~~~~~~~~~~~~~~~~
129 }]
~~~~~~~~~
Found 1 error.
In my package.json, I'm using the following version of the official airtable module:
"dependencies": {
"airtable": "^0.12.2",
This definitely seems broken, especially considering the documentation states:
"To add attachments to QR Code, add new attachment objects to the existing array. Be sure to include all existing attachment objects that you wish to retain, to keep preexisting attachments providing id is required (which can be retrieved using the retrieve endpoint), other fields are ignored. For the new attachments being added, url is required, and filename is optional. To remove attachments, include the existing array of attachment objects, excluding any that you wish to remove."
I would really appreciate help with this, even if it's just a temporary workaround. And no, adding the image at record creation is not an option unfortunately, it must be done as an update.