Next.js Discord

Discord Forum

Service Worker waitUntil

Unanswered
coder2000 posted this in #help-forum
Open in Discord
I am trying to build my next app with a service worker but keep getting this error:

./public/sw.js:12:9
Type error: Property 'waitUntil' does not exist on type 'Event'.

  10 | // Install event - cache basic assets
  11 | self.addEventListener('install', (event) => {
> 12 |   event.waitUntil(
     |         ^
  13 |     caches.open(CACHE_NAME)
  14 |       .then((cache) => cache.addAll(urlsToCache))
  15 |   );
Next.js build worker exited with code: 1 and signal: null

1 Reply

I added //@ts-ignore comments and it let the build continue