Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during service worker registration #3980

Closed
milad1367 opened this issue Feb 11, 2018 · 4 comments
Closed

Error during service worker registration #3980

milad1367 opened this issue Feb 11, 2018 · 4 comments

Comments

@milad1367
Copy link

milad1367 commented Feb 11, 2018

Description

i use --prefix-paths and i defined pathPrefix.
in localhost every things is perfect. but in real host i am encounter with this error :

Error during service worker registration: 
DOMException {  }
register-service-worker.js:42:6

Environment

Gatsby version: "gatsby": "^1.9.153",
Node.js version: 8.9.2
Operating System: mac os saria

File contents (if changed):

gatsby-config.js:

   require('dotenv/config');
module.exports = {
  siteMetadata: {
    title: 'BullOfTheWeek',
    author: 'Kyle Mathews',
    description: 'BullOfTheWeek.com Crypto Trading Website',
    siteUrl: 'https://gatsbyjs.github.io/gatsby-starter-blog/',
  },
 // pathPrefix: '/' + process.env.remoteDevRoot,
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/pages`,
        name: 'pages',
      },
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 590,
            },
          },
          {
            resolve: `gatsby-remark-responsive-iframe`,
            options: {
              wrapperStyle: `margin-bottom: 1.0725rem`,
            },
          },
          'gatsby-remark-prismjs',
          'gatsby-remark-copy-linked-files',
          'gatsby-remark-smartypants',
        ],
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-google-analytics`,
      options: {
        //trackingId: `ADD YOUR TRACKING ID HERE`,
      },
    },
    `gatsby-plugin-feed`,
    `gatsby-plugin-offline`,
    `gatsby-plugin-react-helmet`,
    {
      resolve: 'gatsby-plugin-typography',
      options: {
        pathToConfigModule: 'src/utils/typography',
      },
    },
  ],
}

         

Steps to reproduce

1. for a test I delete path prefix

2.and build it with: gatsby build
3. in localhost everything is ok!

4. but now I have same problems i real host:

register-service-worker.js:42 Error during service worker registration: DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).

It does not seem to be a problem with path prefix!

@m-allanson
Copy link
Contributor

@milad1367 Am I right in thinking gatsby build works locally with pathPrefix and without pathPrefix, but you see that error on your live domain? The error is related to how Chrome handles service workers.

I think you can fix this either by adding https support to your live site or removing the gatsby-plugin-offline plugin.

@milad1367
Copy link
Author

yes. i come back the gatsby starter and test it.i remove prefix-path from config. but it is not solved.

see it!

@m-allanson
Copy link
Contributor

@milad1367 You need to use a https:// url for Service Workers to be enabled: https://aberrant-cough.surge.sh/

See the surge docs on forcing https: https://surge.sh/help/using-https-by-default

@milad1367
Copy link
Author

@m-allanson guy, I deleted gatsby-plugin-offline and that problem solved.
thanks a lot. 👍
I use prefix-paths and the problem was not with it.

This was referenced Sep 5, 2021
This was referenced Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants