Answers Final Challenge Publish issue

Hi! I am trying to publish my answers build to my staging link but I keep seeing the attached issue and I’m not sure why because I only made a few syntax changes since the last publish. Any guidance would be really appreciated! Thanks!

staging environment: https://sandbox.yext.com/s/2677016/sites/90840/publishing/?filter={"env"%3A"staging"%2C"builds"%3A{"offset"%3A0%2C"limit"%3A25}%2C"activity"%3A"all"%2C"origin"%3A"YEXT"}#tab=RECENT_ACTIVITY

Hey Aarti,

Looks like there’s a syntax error (extra bracket) and that’s why the publish is failing. Once you remove the extra bracket (see below), Live Preview works and so the build and publish should go through as well. Make sure to check that Live Preview works before committing changes.

To help you and others troubleshoot in the future, here’s a walkthrough of how to find this error and then resolve it.

There’s a couple ways you can find this error:

Take a look at the failed builds. I would start here instead of the failed publish since the publish is failing due to the build failing. Click “View” on the first (oldest) failed build.

From here, I would CTRL+F for “error” and move past the instances that are part of a file name until you get to an actual error. As you can see from the screenshot below, there is an unexpected , in the config/professionals.json file.

Now that you know where the error is, you can look at this file in the Code Editor.

Look in the Code Editor at recently edited files. Since you only edited the professionals config/hbs files in this most recent commit, you can also go directly to this file in the Code Editor to troubleshoot this.

Open the Code Editor Console and see if there are any errors. If you’re starting a new session or coming back to the Code Editor, you may need to make a change in the Code Editor for the preview to refresh. Here, I just added ... to the pageTitle.

In the screenshot below, you can see I get the same error message in the Console as I did in the failed build. In the file itself, there is a red squiggly line under the , on line 50 to indicate an error. This closing bracket } pairs with the opening bracket on line 1 and so actually ends the file. This comma is out of place because the end of the file is expected.

Resolving the Error

To resolve this error, you should do a quick audit of the opening and closing brackets { } in this file. Clicking next to a bracket will highlight that bracket and its opening or closing pair.

In the screenshot below, the componentSettings brackets are on lines 13 and 31. However, all the components below it (AppliedFilters, VerticalResults, SearchBar, and Pagination) should actually be inside these brackets. It looks like the closing bracket on line 31 was mistakenly commented in - it’s part of the commented out FilterLink component.

Solution: Once I comment out line 31, the rest of the brackets on the page match up properly. The console shows no errors as it refreshes the preview and I’m able to open and load Live Preview. You should always check that Live Preview works before committing changes. This will give you faster feedback on whether the experience is working rather than waiting for the commit to build and publish.

Hope this helps! Feel free to reach out if you have any questions about this or the debugging process.