netlify / blobs

A TypeScript client for Netlify Blobs
https://docs.netlify.com/blobs/overview
MIT License
16 stars 5 forks source link

Get Store errors in NextJs API route #192

Open himynameistim opened 2 months ago

himynameistim commented 2 months ago

Describe the bug

I have a site using NextJs 13.4.10, and the build log shows Netlify automicatically installing @netlify/plugin-nextjs@4.41.3.

My site contains an API route which calls an external service. To cut down the number of API calls to this service I'm attempting to cache the results using Netlify Blobs. This will use a deploy specific store.

When I call the function to get the store the application errors. e.g.

const myStore = getDeployStore('myStore')

The following error is shown in the logs

Aug 19, 08:37:39 AM: 77dc63f7 ERROR  MissingBlobsEnvironmentError: The environment has not been configured to use Netlify Blobs. To use it manually, supply the following properties when creating a store: deployID
    at getDeployStore (/var/task/node_modules/@netlify/blobs/dist/main.cjs:624:11)
    at PrismicServices.getAlternativeTracks (/var/task/.next/server/chunks/5428.js:589:92)
    at search_events (/var/task/.next/server/pages/api/search-events.js:681:61)
    at /var/task/node_modules/next/dist/server/api-utils/node.js:463:16
    at /var/task/node_modules/next/dist/server/lib/trace/tracer.js:117:36
    at NoopContextManager.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
    at ContextAPI.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
    at NoopTracer.startActiveSpan (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)
    at ProxyTracer.startActiveSpan (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)
    at /var/task/node_modules/next/dist/server/lib/trace/tracer.js:106:107
Saurav017 commented 2 months ago

Hello @himynameistim , if this issue is still open. Can you please assign it to me ?