How @uppy/golden-retriever integrate with Nextjs?

I want to use @uppy/golden-retriever with nextjs for restore files when refreshing page

So, situation is

  1. I install next-pwa for adding service-worker in Nextjs environments
  2. In custom service-worker file, I require(’@uppy/golden-retriever’) for bundle @uppy/golden-retriever
  3. In _documnet.js, Make uppy instance and add GoldenRetriever option({serviceWorker: true}) to uppy
  4. also, I register @uppy/goldenretriever 's service-worker

Problem is

Error occured - can’t find localStorage and IndexedDB

why those Errors occur?

How can I solve it?(for integrating nextjs and @uppy/golden-retriever)