Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
Error en Service Worker: no se puede construir una solicitud con un objeto de solicitud que ya se ha utilizado

Cuando se ejecuta el siguiente código de trabajador de servicio, aparece un montón de estos errores:

serv-worker.js:38 No capturado (en promesa) TypeError: no se pudo ejecutar 'fetch' en 'WorkerGlobalScope': no se puede construir una solicitud con un objeto de solicitud que ya se ha utilizado.

Pregunta también hecha aquí y sin respuesta: [https://stackoverflow.com/questions/55979921/error-request-object-that-has-already-been-used]

¡Agradecimientos por cualquier ayuda/explicación!

 console.log('Start serv-worker.js'); const cacheName = '3.2121'; var urlsToCache = [ 'home.html', 'home-js.js', 'web-bg.js', 'css/main.css', 'css/edit-menus.css' ]; self.addEventListener('install', event => { console.log('Install event...', urlsToCache); event.waitUntil( caches.open(cacheName) .then(function(cache) { console.log('Opened cache', cacheName); return cache.addAll(urlsToCache); }) ); }); // Network first. self.addEventListener('fetch', (event) => { // Check the cache first // If it's not found, send the request to the network // event.respondWith( // caches.match(event.request).then(function (response) { // return response || fetch(event.request).then(function (response) { // return response; // }); // }) // ); event.respondWith(async function() { try { console.log('aPull from network...', event.request); return await fetch(event.request); } catch (err) { console.log('aPull from cache...', event.request); return caches.match(event.request); } }()); }); self.addEventListener('message', function (event) { console.log('ServiceWorker cache version: ', cacheName, event); console.log('Received msg1: ', event.data); if (event.data.action === 'skipWaiting') { console.log('ccClearing cache: ', cacheName); // caches.delete('1.9rt1'); // hardcode old one // caches.delete(cacheName); // actually removes cached versions caches.keys().then(function(names) { for (let name of names) caches.delete(name); }); self.skipWaiting(); } });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!