Netlify blobs 404 error

I have a lambda function that is trying to store (and retrieve) data from a blob, but I am having real trouble with the blob API.

Here is my code:

const { getDeployStore } = require('@netlify/blobs');

exports.handler = async function(event, context) {
// fetches data from a third-party API and sets it as 'availableTimes' - the idea is to reduce the number of calls to this API

const store = getDeployStore({ siteID: SITE_ID, token: TOKEN, deployID: DEPLOY_ID });
    await store.setJSON(CACHE_KEY, availableTimes);
    console.log('Available times cached in Netlify Blobs:', availableTimes);

    return {
      statusCode: 200,
      body: JSON.stringify({ message: 'Cache updated successfully' }),
  } catch (error) {
    console.error('Error in update-cache function:', error);
    return {
      statusCode: 500,
      body: JSON.stringify({ error: error.message }),

SITE_ID = ‘lovely-maamoul-1f6c06’;
TOKEN = process.env.NETLIFY_AUTH_TOKEN; // this is generated from my Netlify account as a personal access token and then stored in an .env file (i am currently only testing locally)
const DEPLOY_ID = process.env.DEPLOY_ID || ‘mock-deploy-id’; // mocked up the deploy ID as testing locally
CACHE_KEY = ‘available-times’;

I am getting the following error, which is making me think that some of the tokens being passed are incorrect:

Error in update-cache function: BlobsInternalError: Netlify Blobs has generated an internal error (400 status code)

Any ideas?

Hi @crushgh,

Thanks for reaching out and thanks for providing all the details.

Would it be possible to multiple add console.log to ensure that all values (SITE_ID, TOKEN, DEPLOY_ID, etc…) are correct and as expected?

Note there are some troubleshooting tips in Netlify’s Blog docs here:

Netlify Blobs | Netlify Docs

Thanks for the reply.

So process.env.DEPLOY_ID || 'mock-deploy-id' was giving ‘0’ (probably because I am on dev so no process.env.DEPLOY_ID). mock-deploy-id resulted in the error Error: 'mock-deploy-id' is not a valid Netlify deploy ID.

Giving my most recent deploy id gives the following if I log store to the console:

_Store {
  client: Client {
    apiURL: undefined,
    consistency: 'eventual',
    edgeURL: undefined,
    fetch: [AsyncFunction: fetch],
    region: undefined,
    siteID: 'lovely-maamoul-1f6c06',
    token: 'nfp_xEYCbuWYBjWasmv2wHx2JRBn3MEYsz4j8XXX',
    uncachedEdgeURL: undefined
  name: 'deploy:664d972281bf8700082b9XXX'

(final three letters of deploy id and Netlify token replaced with XXX)

and still the error: BlobsInternalError: Netlify Blobs has generated an internal error (400 status code)

Don’t think either of the troubleshooting tips apply to me.

Site ID is not the same as site subdomain. Based on your post, you’re using the subdomain and not the ID. Did you try with site ID?

Thanks! Got confused by an answer given by Ask Netlify

No worries, sorry the bot gave you a confusing answer! Glad to hear all is working now!