Closed klapeyre closed 5 years ago
hi @klapeyre have you navigated to: http://localhost:3000/content/wknd-events/react/home.html and also in the same browser open a new tab and authenticate to AEM author instance ( http://localhost:4502)
The "Unexpected token < in JSON at position 0" typically indicates that the model.json isn't being served at all from AEM
Hi @godanny86 - I have localhost:4502 running in another tab and is already authenticated. Ran a new browser in incognito mode to force auth again, and loaded localhost:3000 in a new tab there, but no luck.
ah interesting, and to confirm you are navigating to: http://localhost:3000/content/wknd-events/react/home.html?
And if you navigate to http://localhost:4502/content/wknd-events/react.model.json -> does that show up as expected?
Lastly, do you mind trying to reproduce the issue on the finished code for chapter 2: https://github.com/Adobe-Marketing-Cloud/aem-guides-wknd-events/tree/react/chapter-2?
I will download Ch2 next, and try to re-produce and let you know what I find.
I am getting expected results if I navigate to http://localhost:4502/content/wknd-events/react.model.json when the server is running.
Navigating to http://localhost:3000/content/wknd-events/react/home.html does not show anything.
I have the proxy setup in package.json, and the .env.development variable set as well.
Interesting note: I disabled authentication for that path through the sling authentication in OSGi. Loading the aem path for model.json did not return anything. But after logging into the server and re-loading, it appears. So something else must be going on...
Found the issue - I misinterpreted the section about adding the proxy to the package.json file and added inside the scripts section rather than beneath it.
Closing this issue. Thanks for your help troubleshooting.
No problem! I can update the tutorial to expand that snippet of code to make it more clear. Sorry for the confusion
Local Environment Before filing an issue, verify that the prerequisite tools/software are installed:
Describe the issue During Chapter 2, Proxy JSON approach
Running npm start works, browser page opens at localhost:3000, but no page is seen. I see an error in the console "Unexpected token < in JSON at position 0.
Occurring line 572 in cq-spa-page-model-manager.js. The response is not being parsed correctly.
I am able to setup a mock model.json as described in the next section, but obviously would prefer to work with a proxy. I have the proxy setup in package.json, and the .env.development pointing to the correct url "/content/wknd-events/react.model.json"
Unsure what is causing the issue. I tried downgrading to the last version of cq-spa-page-model-manager since an update was just released, and I also tried matching node environments to that of the tutorial - no luck.
Any advice would be appreciated.