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

191
Views
DOMException: la operación no es segura durante la adición o recuperación de caché

Quiero agregar caché a mi sitio. Estoy usando las siguientes dos funciones para agregar y obtener el caché. Funciona bien durante el desarrollo, pero cuando uso Docker para compilar la aplicación, el almacenamiento en caché no funciona. Me está dando el siguiente error. (DOMException no detectada (en promesa): la operación no es segura).

Imagen que muestra el error

Aquí está mi código.

 export const addDataIntoCache = (cacheName, url, response) => { // Converting our response into Actual Response form const data = new Response(JSON.stringify(response)); if ('caches' in window) { // Opening given cache and putting our data into it caches.open(cacheName).then((cache) => { cache.put(url, data); console.log('Data Added into cache!') }); } else { console.log("does not able to find caches in window"); caches.open(cacheName).then((cache) => { cache.put(url, data); console.log('Data Added into cache!') }); } }; export const getSingleCacheData = async (cacheName, url) => { if (typeof caches === 'undefined') { console.log("cache is undefined"); return null; } const cacheStorage = await caches.open(cacheName); const cachedResponse = await cacheStorage.match(url); // If no cache exists if (!cachedResponse || !cachedResponse.ok) { console.log('Fetched failed!'); return null; } return cachedResponse.json().then((item) => { console.log("fetched from cache"); console.log(item); return item; }); };
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!