Amal
Amal

Reputation: 71

Spartacus store front returning empty page on hitting localhost:4200. Web page title is getting loaded,but no content from CMS is getting loaded

I have set up my spartacus store using Hybris 1905,npm, node and angularcli. But on hitting the home page url localhost:4200, I am getting a blank page. Please help

Upvotes: 1

Views: 2369

Answers (4)

geffchang
geffchang

Reputation: 3340

I tested Spartacus 1.4 Electronics SPA with the (latest) Angular CLI 8.3.25, Node 12.16.1, Yarn 1.22.0, and it's working fine.

As others mentioned, it may be a CORS issue. I also get a blank page if CORS is not configured properly, but works if I add CORS configuration. Try adding this in your local.propperties and restarting the Hybris app:

corsfilter.ycommercewebservices.allowedOrigins=http://localhost:4200 https://localhost:4200
corsfilter.ycommercewebservices.allowedMethods=GET HEAD OPTIONS PATCH PUT POST DELETE
corsfilter.ycommercewebservices.allowedHeaders=origin content-type accept authorization cache-control if-none-match x-anonymous-consents
corsfilter.ycommercewebservices.exposedHeaders=x-anonymous-consents
corsfilter.assistedservicewebservices.allowedHeaders=origin content-type accept authorization x-anonymous-consents
corsfilter.assistedservicewebservices.exposedHeaders=x-anonymous-consents

NOTE: The Spartacus documentation recommends Angular 8.x, not 9.x.

Upvotes: 1

Amal
Amal

Reputation: 71

The issue is fixed.It was because of the latest versions of node and angular cli we used.

Upvotes: 0

Adrian Fella
Adrian Fella

Reputation: 190

This sounds like either there is no Sampledata present in Hybris or there is a CORS Issue, have you installed a Samplestore in Hybris and configured CORS?

Here are the links to the Spartacus documentation:

https://sap.github.io/cloud-commerce-spartacus-storefront-docs/installing-sap-commerce-cloud/#setting-up-sap-commerce-cloud

https://sap.github.io/cloud-commerce-spartacus-storefront-docs/installing-sap-commerce-cloud/#configuring-cors

Upvotes: 1

tobi-or-not-tobi
tobi-or-not-tobi

Reputation: 1260

are you sure you run the app on http://localhost:4002?

The angular CLI uses the 4200 port by default. If you did mean the 4200 port, perhaps you can share any logs from the browser console? There might be some helpful messages that indicate the issue.

Upvotes: 0

Related Questions