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

Unclear Config Parsing Error Message #1

Open
Mx455 opened this issue Jan 1, 2022 · 3 comments
Open

Unclear Config Parsing Error Message #1

Mx455 opened this issue Jan 1, 2022 · 3 comments
Labels
enhancement New feature or request invalid This doesn't seem right

Comments

@Mx455
Copy link

Mx455 commented Jan 1, 2022

Hi,

When running the program with cargo run --release I got the following error: [ERROR] Invalid config file!.

My shopify-monitor.log file contains the following messages:

[2022-01-01 17:09:36.375] [HIDDEN] Starting Program...
[2022-01-01 17:09:36.376] [IMPORTANT] LOADING SETTINGS
[2022-01-01 17:09:36.376] [HIDDEN] Loading config.json...
[2022-01-01 17:09:36.376] [DEFAULT] Reading config file...
[2022-01-01 17:09:36.377] [HIDDEN] Failed to parse config.json: expected , or ] at line 571 column 3
[2022-01-01 17:09:36.377] [ERROR] Invalid config file!
[2022-01-01 17:09:36.377] [DEFAULT] Please follow the instructions on https://github.com/subreme/shopify-monitor to complete the configuration process.
[2022-01-01 17:09:36.377] [ERROR] Press Enter to close the program...

How can I solve this problem? I simply edited the original config.json, changing the Webhook URLs, as shown below:

{ "sites": { "AFEW": { "url": "https://en.afew-store.com", "logo": "afew", "delay": 5000 }, "asphaltgold": { "url": "https://www.asphaltgold.com", "logo": "asphaltgold", "delay": 5000 }, "atmos": { "url": "https://www.atmosusa.com", "logo": "atmos", "delay": 5000 }, "Bodega": { "url": "https://bdgastore.com", "logo": "bodega", "delay": 5000 }, "Concepts": { "url": "https://cncpts.com", "logo": "concepts", "delay": 5000 }, "Extra Butter": { "url": "http://extrabutterny.com", "logo": "extrabutter", "delay": 5000 }, "HANON": { "url": "https://www.hanon-shop.com", "logo": "hanon", "delay": 5000 }, "Jimmy Jazz": { "url": "https://www.jimmyjazz.com", "logo": "jimmyjazz", "delay": 5000 }, "Kith": { "url": "https://kith.com", "logo": "kith", "delay": 5000 }, "Notre": { "url": "https://www.notre-shop.com", "logo": "notre", "delay": 5000 }, "Packer": { "url": "https://packershoes.com", "logo": "packer", "delay": 5000 }, "Shoe Palace": { "url": "https://www.shoepalace.com", "logo": "shoepalace", "delay": 5000 }, "Sneaker Politics": { "url": "https://sneakerpolitics.com", "logo": "sneakerpolitics", "delay": 5000 }, "Travis Scott": { "url": "https://shop.travisscott.com", "logo": "travisscott", "delay": 5000 }, "UNDEFEATED": { "url": "https://undefeated.com", "logo": "undefeated", "delay": 5000 }, "West NYC": { "url": "https://www.westnyc.com", "logo": "westnyc", "delay": 5000 } }, "servers": [ { "name": "Test Server", "settings": { "username": "Shopify Monitor", "avatar": "https://avatars.githubusercontent.com/u/50165445", "color": null, "sizes": true, "thumbnail": true, "image": false, "footer_text": "go.go.go", "footer_image": "https://avatars.githubusercontent.com/u/50165445", "timestamp": true, "minimum": 0, "keywords": null }, "channels": { "#minimalist": { "url": "xxxx_url_webhook", "settings": { "image": true }, "sites": { "AFEW": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "asphaltgold": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "atmos": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Bodega": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Concepts": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Hanon": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Extra Butter": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Jimmy Jazz": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Kith": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Notre": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Packer": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Shoe Palace": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Sneaker Politics": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "Travis Scott": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "UNDEFEATED": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] }, "West NYC": { "events": [ { "restock": true, "password_up": true, "password_down": true } ] } } }, "#normal": { "url": "xxxx_url_webhook", "settings": { "sizes": true, "thumbnail": true, "footer_text": "go.go.go", "footer_image": "https://avatars.githubusercontent.com/u/50165445", "timestamp": true }, "sites": { "AFEW": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "asphaltgold": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "atmos": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Bodega": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Concepts": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Hanon": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Extra Butter": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Jimmy Jazz": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Kith": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Notre": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Packer": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Shoe Palace": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Sneaker Politics": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "Travis Scott": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "UNDEFEATED": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] }, "West NYC": { "events": [ { "restock": true }, { "password_up": true, "settings": { "color": "#e74c3c" } }, { "password_down": true, "settings": { "color": "#2ecc71" } } ] } } } } } } }
@subreme
Copy link
Owner

subreme commented Jan 1, 2022

Hey Branko!

I copied and pasted your config file contents into my editor and found that it wasn't valid JSON. As the Failed to parse config.json: expected, or ] at line 571 column 3 log (an error message automatically generated by the serde library) suggests, the second to last "closing curly brace" } should actually be a "closing square bracket" ]. This is because you changed the "servers": { field from an object (having named servers inside it) to an array, switching the bracket type, but forgot to change the matching closing brace at the end of the field.

You should edit your file to this:

{
  "sites": {
    "AFEW": {
      "url": "https://en.afew-store.com",
      "logo": "afew",
      "delay": 5000
    },
    "asphaltgold": {
      "url": "https://www.asphaltgold.com",
      "logo": "asphaltgold",
      "delay": 5000
    },
    "atmos": {
      "url": "https://www.atmosusa.com",
      "logo": "atmos",
      "delay": 5000
    },
    "Bodega": {
      "url": "https://bdgastore.com",
      "logo": "bodega",
      "delay": 5000
    },
    "Concepts": {
      "url": "https://cncpts.com",
      "logo": "concepts",
      "delay": 5000
    },
    "Extra Butter": {
      "url": "http://extrabutterny.com",
      "logo": "extrabutter",
      "delay": 5000
    },
    "HANON": {
      "url": "https://www.hanon-shop.com",
      "logo": "hanon",
      "delay": 5000
    },
    "Jimmy Jazz": {
      "url": "https://www.jimmyjazz.com",
      "logo": "jimmyjazz",
      "delay": 5000
    },
    "Kith": {
      "url": "https://kith.com",
      "logo": "kith",
      "delay": 5000
    },
    "Notre": {
      "url": "https://www.notre-shop.com",
      "logo": "notre",
      "delay": 5000
    },
    "Packer": {
      "url": "https://packershoes.com",
      "logo": "packer",
      "delay": 5000
    },
    "Shoe Palace": {
      "url": "https://www.shoepalace.com",
      "logo": "shoepalace",
      "delay": 5000
    },
    "Sneaker Politics": {
      "url": "https://sneakerpolitics.com",
      "logo": "sneakerpolitics",
      "delay": 5000
    },
    "Travis Scott": {
      "url": "https://shop.travisscott.com",
      "logo": "travisscott",
      "delay": 5000
    },
    "UNDEFEATED": {
      "url": "https://undefeated.com",
      "logo": "undefeated",
      "delay": 5000
    },
    "West NYC": {
      "url": "https://www.westnyc.com",
      "logo": "westnyc",
      "delay": 5000
    }
  },
  "servers": [
    {
      "name": "Test Server",
      "settings": {
        "username": "Shopify Monitor",
        "avatar": "https://avatars.githubusercontent.com/u/50165445",
        "color": null,
        "sizes": true,
        "thumbnail": true,
        "image": false,
        "footer_text": "go.go.go",
        "footer_image": "https://avatars.githubusercontent.com/u/50165445",
        "timestamp": true,
        "minimum": 0,
        "keywords": null
      },
      "channels": {
        "#minimalist": {
          "url": "xxxx_url_webhook",
          "settings": {
            "image": true
          },
          "sites": {
            "AFEW": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "asphaltgold": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "atmos": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Bodega": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Concepts": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Hanon": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Extra Butter": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Jimmy Jazz": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Kith": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Notre": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Packer": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Shoe Palace": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Sneaker Politics": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "Travis Scott": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "UNDEFEATED": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            },
            "West NYC": {
              "events": [
                {
                  "restock": true,
                  "password_up": true,
                  "password_down": true
                }
              ]
            }
          }
        },
        "#normal": {
          "url": "xxxx_url_webhook",
          "settings": {
            "sizes": true,
            "thumbnail": true,
            "footer_text": "go.go.go",
            "footer_image": "https://avatars.githubusercontent.com/u/50165445",
            "timestamp": true
          },
          "sites": {
            "AFEW": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "asphaltgold": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "atmos": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Bodega": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Concepts": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Hanon": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Extra Butter": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Jimmy Jazz": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Kith": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Notre": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Packer": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Shoe Palace": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Sneaker Politics": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "Travis Scott": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "UNDEFEATED": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            },
            "West NYC": {
              "events": [
                {
                  "restock": true
                },
                {
                  "password_up": true,
                  "settings": {
                    "color": "#e74c3c"
                  }
                },
                {
                  "password_down": true,
                  "settings": {
                    "color": "#2ecc71"
                  }
                }
              ]
            }
          }
        }
      }
    }
  ]
}

Hope this helps!

I edited the message as it turns out that GitHub doesn't format Markdown new-lines for Issue Comments in the same way as it does elsewhere...

@subreme
Copy link
Owner

subreme commented Jan 1, 2022

I do realize that the way these errors are reported is confusing, so I'll try to look into clearer messages that distinguish between invalid syntax, missing fields, and so on.

@subreme subreme added invalid This doesn't seem right enhancement New feature or request labels Jan 1, 2022
@subreme subreme changed the title [ERROR] Invalid config file! Unclear Error Message Jan 1, 2022
@subreme subreme changed the title Unclear Error Message Unclear Config Parsing Error Message Jan 1, 2022
@Mx455
Copy link
Author

Mx455 commented Jan 1, 2022

I do realize that the way these errors are reported is confusing, so I'll try to look into clearer messages that distinguish between invalid syntax, missing fields, and so on.

ok thanks now it works... it would be more understandable.
How can I let the "$ cargo run --release" work in the background once it has started? monitor on a server ubuntu for continuous runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants