Error: "The product, category or CMS page is not available in Offline mode"

Hi,
I’m stuck with the problem that you can see on this screenshot:

Those are the console and the network tab:

Response: {"took":288,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

I’ve already tried the solution suggested on this post:

But it doesn’t work, in my case.

What are your suggestions for it?

Thanks in advance :wink:

Well, you must have products imported to ElasticSearch. mage2vuestorefront is usually a good solution for dev purposes. Why it doesn’t work in your case?

Check the docs.vuestorefront.io - particularly the Cookbook section on Data Imports

Sorry for my incredible delay in the response…

I’ve used it, but I still get this error if I try to navigate on the category page:
The product, category or CMS page is not available in Offline mode. Redirecting to Home.

I can’t understand why.
The indexes are okay. If I run on the shell:

curl -XGET "http://localhost:9200/vue_storefront_catalog_it/_search?pretty=true" -H 'Content-Type: application/json' -d'
    {
      "query": {
        "terms": {
          "_type": [ "category" ] 
        }
      }
    }'

I receive:

{
  "took" : 18,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 3,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "vue_storefront_catalog_it_1579272664",
        "_type" : "category",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "id" : 2,
          "parent_id" : 1,
          "name" : "Default Category",
          "is_active" : true,
          "position" : 1,
          "level" : 1,
          "product_count" : 1,
          "children_data" : [
            {
              "id" : 3,
              "parent_id" : 2,
              "name" : "cat1",
              "is_active" : true,
              "position" : 1,
              "level" : 2,
              "product_count" : 4,
              "children_data" : [
                {
                  "id" : 4,
                  "parent_id" : 3,
                  "name" : "categoria-seconda",
                  "is_active" : true,
                  "position" : 1,
                  "level" : 3,
                  "product_count" : 2,
                  "children_data" : [ ],
                  "children" : "",
                  "created_at" : "2019-12-06 15:37:39",
                  "updated_at" : "2019-12-06 15:59:20",
                  "path" : "1/2/3/4",
                  "available_sort_by" : [ ],
                  "include_in_menu" : true,
                  "display_mode" : "PRODUCTS",
                  "is_anchor" : "1",
                  "children_count" : "0",
                  "custom_use_parent_settings" : "0",
                  "custom_apply_to_products" : "0",
                  "url_key" : "categoria-seconda-4",
                  "url_path" : "cat1/categoria-seconda/categoria-seconda-4",
                  "slug" : "categoria-seconda-4"
                }
              ],
              "children" : "4",
              "created_at" : "2019-12-06 15:37:17",
              "updated_at" : "2019-12-06 15:58:53",
              "path" : "1/2/3",
              "available_sort_by" : [ ],
              "include_in_menu" : true,
              "display_mode" : "PRODUCTS",
              "is_anchor" : "1",
              "children_count" : "1",
              "custom_use_parent_settings" : "0",
              "custom_apply_to_products" : "0",
              "url_key" : "cat1-3",
              "url_path" : "cat1/cat1-3",
              "slug" : "cat1-3"
            }
          ],
          "url_key" : "default-category-2",
          "slug" : "default-category-2",
          "url_path" : "default-category-2",
          "children" : "3",
          "created_at" : "2019-12-06 13:32:25",
          "updated_at" : "2019-12-06 15:37:39",
          "path" : "1/2",
          "available_sort_by" : [ ],
          "include_in_menu" : true,
          "display_mode" : "PRODUCTS",
          "children_count" : "2",
          "tsk" : 1579268818501
        }
      },
      {
        "_index" : "vue_storefront_catalog_it_1579272664",
        "_type" : "category",
        "_id" : "4",
        "_score" : 1.0,
        "_source" : {
          "id" : 4,
          "parent_id" : 3,
          "name" : "categoria-seconda",
          "is_active" : true,
          "position" : 1,
          "level" : 3,
          "product_count" : 2,
          "children_data" : [ ],
          "children" : "",
          "created_at" : "2019-12-06 15:37:39",
          "updated_at" : "2019-12-06 15:59:20",
          "path" : "1/2/3/4",
          "available_sort_by" : [ ],
          "include_in_menu" : true,
          "display_mode" : "PRODUCTS",
          "is_anchor" : "1",
          "children_count" : "0",
          "custom_use_parent_settings" : "0",
          "custom_apply_to_products" : "0",
          "url_key" : "categoria-seconda-4",
          "url_path" : "cat1/categoria-seconda/categoria-seconda-4",
          "slug" : "categoria-seconda-4",
          "tsk" : 1579268818501
        }
      },
      {
        "_index" : "vue_storefront_catalog_it_1579272664",
        "_type" : "category",
        "_id" : "3",
        "_score" : 1.0,
        "_source" : {
          "id" : 3,
          "parent_id" : 2,
          "name" : "cat1",
          "is_active" : true,
          "position" : 1,
          "level" : 2,
          "product_count" : 4,
          "children_data" : [
            {
              "id" : 4,
              "parent_id" : 3,
              "name" : "categoria-seconda",
              "is_active" : true,
              "position" : 1,
              "level" : 3,
              "product_count" : 2,
              "children_data" : [ ],
              "children" : "",
              "created_at" : "2019-12-06 15:37:39",
              "updated_at" : "2019-12-06 15:59:20",
              "path" : "1/2/3/4",
              "available_sort_by" : [ ],
              "include_in_menu" : true,
              "display_mode" : "PRODUCTS",
              "is_anchor" : "1",
              "children_count" : "0",
              "custom_use_parent_settings" : "0",
              "custom_apply_to_products" : "0",
              "url_key" : "categoria-seconda-4",
              "url_path" : "cat1/categoria-seconda/categoria-seconda-4",
              "slug" : "categoria-seconda-4"
            }
          ],
          "children" : "4",
          "created_at" : "2019-12-06 15:37:17",
          "updated_at" : "2019-12-06 15:58:53",
          "path" : "1/2/3",
          "available_sort_by" : [ ],
          "include_in_menu" : true,
          "display_mode" : "PRODUCTS",
          "is_anchor" : "1",
          "children_count" : "1",
          "custom_use_parent_settings" : "0",
          "custom_apply_to_products" : "0",
          "url_key" : "cat1-3",
          "url_path" : "cat1/cat1-3",
          "slug" : "cat1-3",
          "tsk" : 1579268818501
        }
      }
    ]
  }
}

What’s wrong with that? I can’t understand it…

Hi! Please make sure you ran Yarn db rebuild within the vsfapi folder in order to make sure the proper elastic schema got applied

Hi @pkarw,

already done, but nothing to do… Same error.

OK, it’s hard for me to say then :frowning: Please maybe take the ElasticQuery which is being executed (you can do this by adding console.log(requestBody) to vue-storefront-api/api/catalog.js and then try to execute the same query against your elasticSearch instance and try to find the reason why there are no results. It must be something wrong with your source data (?)

I’ve modified the vue-storefront-api/src/api/catalog.js file adding a simple console log, but I can’t see the modifications. I’ve re-run yarn dev command on the api folder and cleared the cache of the browser. What else I need to do in order to see this change?
Thanks in advance @pkarw

Ok @pkarw, that’s the failed request:
http://localhost:8080/api/catalog/vue_storefront_catalog_it/category/_search?_source_exclude=sgn&_source_include=id%2C%2A.children_data.id%2C%2A.id%2Cchildren_count%2Csku%2Cname%2Cis_active%2Cparent_id%2Clevel%2Curl_key%2Curl_path%2Cproduct_count%2Cpath&from=0&request=%7B%22query%22%3A%7B%22bool%22%3A%7B%22filter%22%3A%7B%22bool%22%3A%7B%22must%22%3A%5B%7B%22terms%22%3A%7B%22url_key%22%3A%5B%22cat1-3%22%5D%7D%7D%2C%7B%22terms%22%3A%7B%22is_active%22%3A%5Btrue%5D%7D%7D%5D%7D%7D%7D%7D%7D&size=4000&sort=position%3Aasc