Not sure why context.params from SSR returns sw.js
Unanswered
Whimbrel posted this in #help-forum

WhimbrelOP
Do you know why getServerSideProps returns sw.js from context.params?

24 Replies

WhimbrelOP
As a workaround I did this:
if (slug === "sw.js") {
return { props: {} }; // Return empty props or handle as needed
}


WhimbrelOP
Hi @Ray hope you're doing well.
Do you have the same problem? Seems like this is a common issue..

nope
have you tried other browser?
or try start the server with different port
PORT=4000 npm run dev
PORT=4000 npm run dev


WhimbrelOP
I've tried also other browser, same issue:

I've tried Firefox + Chrome.
with npm run build && npm run start

WhimbrelOP
hmm, with port:4000 seems to not happen anymore.

@Ray probably you have server worker registered with other app with same url. check your dev tool

look like this is the reason

WhimbrelOP

This service worker helps the browser to serve the page faster and cache the content?

unregister it

@Whimbrel This service worker helps the browser to serve the page faster and cache the content?

only if you have implemented service worker for your app
like pwa
or you can just ignore the error

WhimbrelOP
aa, yea, I've installed pwa on other app, probably that's why I found that sw.js.
Thank you very much :). Now I know what to do.

np