ServerError: post type from endpoints

Hi there,
this is my first time with Frontity.

I have followed the Quick Start Guide but I am getting an error running npx frontity dev

ServerError: post type from endpoints "posts,pages,media" with slug "sw.js" not found
    at Object.eval (webpack-internal:///./node_modules/@frontity/wp-source/src/libraries/handlers/postType.ts:37:21)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at eval (webpack-internal:///./node_modules/@frontity/wp-source/src/actions.ts:22:101) {
  status: 404,
  statusText: 'post type from endpoints "posts,pages,media" with slug "sw.js" not found'

I have already searched here, but I didn’t find any useful thread, for my case. I am using the recommended mars theme, with no changes: just from scratch.
Any help?

Thank you

Hi @davide.prevosto

Welcome to the community. Great to hear that you’re trying out Frontity for the first time. Sorry your first experience has resulted in this error. Could you post the contents of frontity.settings.js here please. You’ll find the file in the root of your Frontity project.

Hello @mburridge,

this is my frontity.settings.js file:

const settings = {
  "name": "frontity",
  "state": {
    "frontity": {
      "url": "https://test.frontity.org",
      "title": "Test Frontity Blog",
      "description": "WordPress installation for Frontity development"
    }
  },
  "packages": [
    {
      "name": "@frontity/mars-theme",
      "state": {
        "theme": {
          "menu": [
            [
              "Home",
              "/"
            ],
            [
              "Nature",
              "/category/nature/"
            ],
            [
              "Travel",
              "/category/travel/"
            ],
            [
              "Japan",
              "/tag/japan/"
            ],
            [
              "About Us",
              "/about-us/"
            ]
          ],
          "featured": {
            "showOnList": false,
            "showOnPost": false
          }
        }
      }
    },
    {
      "name": "@frontity/wp-source",
      "state": {
        "source": {
          "api": "https://test.frontity.org/wp-json"
        }
      }
    },
    "@frontity/tiny-router",
    "@frontity/html2react"
  ]
};

export default settings;

Hmm, okay - that all looks pretty standard. Can you try creating a new project and see what happens. Let me know.

So, let me show you what I’ve done:

npx frontity create frontity
Pick a starter theme to clone: @frontity/mars-theme (recommended)
Do you want to receive framework updates by email? N (because I am already registered)
cd frontity && npx frontity dev

This is the result, on my terminal:

This happens also with the other theme (twentytwenty-theme)

Can you run npx frontity info in the root of your project. Post the output here. Thanks.

So you’re not even changing the API endpoint, you’re just using the default https://test.frontity.org/wp-json?

It’s correct, I have used the default API endpoint. I haven’t made any changes into the settings file.

npx frontity info returns this:

(node:18642) UnhandledPromiseRejectionWarning: TypeError: (e || []).filter is not a function
    at /Users/xxxxxxxxxx/Sviluppo/www/wptest/node_modules/envinfo/dist/envinfo.js:1:73314
    at async Promise.all (index 7)
    at async Object.exports.default [as info] (/Users/xxxxxxxxxx/Sviluppo/www/wptest/node_modules/frontity/dist/src/commands/info.js:8:18)
    at async Command.exports.default (/Users/xxxxxxxxxx/Sviluppo/www/wptest/node_modules/frontity/dist/src/cli/info.js:6:25)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18642) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:18642) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have used node version 12.x and node version 14.x (same npx frontity info message).

Your browser is trying to get the /sw.js URL, but it doesn’t exist. Frontity thinks it may be a post or page with the sw.js slug, so it’s trying to find it in the WordPress database, but it cannot found it.

That URL (/sw.js) is usually the Service Worker file. Frontity doesn’t request that file because support for Service Workers hasn’t been added yet.

I guess you may have a Chrome/Firefox extension that may be doing the request. Could you please deactivate all your extensions to check it out? What browser are you using?