Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Automatic updates isn't the default behavior, but can be achieved using the [aut


`offline-plugin` automatically caches all resources generated by webpack. Any other resource needs to be explicitly cached as [external](options.md#externals-arraystring).

#### Some pages / resources are not being served at all

The ServiceWorker can only serve resources within its [scope](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register). Serve your sw file from the root of your public folder, or supply the correct [`ServiceWorker.scope` option](options.md#serviceworker-object--null--false).
Expand Down Expand Up @@ -53,3 +54,27 @@ There are multiple ways to fix this depending on your setup. One way is to set [
#### Resources served from a CDN are not being cached

`offline-plugin` can cache resources served from a CDN, given the correct configuration. Make sure the resources are served with the correct headers.

#### Fetching the ServiceWorker results in an error

Some errors, like being unable to fetch the ServiceWorker file, originates from the browser, network or server and are out of control of `offline-plugin`. Here is a list of common errors and their causes.

> TypeError: Failed to update a ServiceWorker: A bad HTTP response code (500) was received when fetching the script.

This is a server error. Whatever happens there - it shouldn't. Could be that the server is temporarily down (e.g. changing a deployment on Zeit).

> TypeError: Failed to fetch

This is the most generic error you will receive. It typically happens when there's no network connection - it simply can't fetch the file.

> AbortError: Failed to update a ServiceWorker: The request to fetch the script was interrupted.

This is a network error - something interrupted the connection. It might be due to the network connection being changed or temporarily lost (it happens all the time in the wild).

> TypeError: Script URL https://my-page.com/sw.js fetch resulted in error: An SSL error has occurred and a secure connection to the server cannot be made.

This is a proxy issue. Ie. someone sitting at an airport or on a train and that network injects fake HTTPS certificates (man in the middle).

#### How to handle out-of-control errors

As the above errors are out of the control of `offline-plugin`, there is nothing we can do to prevent them. What you may do if you receive any of them is to catch them in your code and try to reschedule the update. Also make sure that your server works correctly and remove any potential bugs / error situation causing HTTP 500 Internal Server Error.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NekR do you know if we have any docs regarding this which we may link to?