shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.75k stars 311 forks source link

Question about the handling of /api/auth/ in cache.js #409

Open satoqz opened 1 year ago

satoqz commented 1 year ago

I have a quick question about the api route handling in cache.js. As i take it from the comment in https://github.com/shadowwalker/next-pwa/blob/1e6af5fa9f6a807930f451adb5ab5078d5cda451/cache.js#L133 and the discussion in https://github.com/shadowwalker/next-pwa/issues/131, requests to /api/auth/callback/* should not be cached. However, with the current configuration, any call to /api/auth/ is not cached: https://github.com/shadowwalker/next-pwa/blob/1e6af5fa9f6a807930f451adb5ab5078d5cda451/cache.js#L136 This includes calls to /api/auth/session which are arguably quite essential for offline usage especially when all other api routes are cached. In the previous revision of cache.js, indeed only /api/auth/callback/* is not cached and /api/auth/ is accepted: https://github.com/shadowwalker/next-pwa/blob/d0d03f965c3239a9d57af0aa6db08ef2b283275f/cache.js#L97 Is this a mistake or is there some reason that all /api/auth/ calls should not be cached?

NayamAmarshe commented 1 year ago

Using Google OAuth results in a

This site can’t be reachedThe web page at http://localhost:3000/api/auth/callback/google?state=..... might be temporarily down or it may have moved permanently to a new web address.
ERR_FAILED

Is this happening because of this? I'm unable to login on dev server because of this error.