I’m utilising Netlify’s Blob storage for a project and developing via netlify dev
locally.
I’m finding that when setting data against a key, that the data results in being blank. No errors are thrown, its a simple text change, and the text isn’t long at all - no special characters or anything. Since the set function itself doesn’t return anything, I cant tell if there’s something off in the function itself or not.
I find that it happens more when a key already exists and I’m attempting to make an update, however, I have experienced it happen on creation too, where it just creates an empty blob.
I’ve checked the data being passed in prior to running the set function, which is present and as expected.
The get
and delete
functions seem to work everytime, just seems to be the set
.
Heres the relative code blocks used:
const reqBody = await req.text()
const callback = (status, response) => {
return new Response(JSON.stringify(response), { status });
}
const updateClient = async (client, body) => {
const store = getStore("clients");
const exists = await store.get(client);
console.log(exists);
if (!exists) {
throw "Client doesn't exist";
}
console.log(body);
await store.set(client, body);
return {success: true};
}
if (subject === 'clients' && action === 'update' && client !== 'null' && getMethod() === 'PUT') {
report();
try {
console.log(reqBody);
const result = await updateClient(client, reqBody);
console.log(result);
return callback(200, result);
} catch (e) {
return callback(500, e);
}
}
An example key would be clientname
and body is typically a JSON string like {"key":"clientname", "name":"Client Name"}
and I’m just changing the client name and it results in the blob being blank.
Is this a known issue at all?