Coder Social home page Coder Social logo

Comments (8)

asadkhawaja1 avatar asadkhawaja1 commented on May 22, 2024

process.env file at Root

LEGACY_BACKEND_DOMAIN=https://zzkc-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.store/Sites-RefArch-Site/
LEGACY_BACKEND_HOST_HEADER=https://zzkc-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.store/Sites-RefArch-Site/
CLIENT_ID=477c9069-ff51-4ead-961c-f58ef1adaa04
ORGANIZATION_ID=f_ecom_ZZKC_001
SHORT_CODE=kv7kzm78
SITE_ID=RefArch

from react-storefront.

dijs avatar dijs commented on May 22, 2024

I am not able to reproduce this error.

What version of node, react-storefront, xdn, and next are you using?

And how did you initialize the project?

from react-storefront.

asadkhawaja1 avatar asadkhawaja1 commented on May 22, 2024

Node v12.18.3
react-storefront : 8.11.0
next : 9.3.6

I am trying it on my local machine.

I created a new react storefront, then installed react-storefront-salesforce-commerce-cloud-connector.

After that, I have put a process.env file at Root which looks like this

LEGACY_BACKEND_DOMAIN=https://zzkc-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.store/Sites-RefArch-Site/
LEGACY_BACKEND_HOST_HEADER=https://zzkc-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.store/Sites-RefArch-Site/
CLIENT_ID=477c9069-ff51-4ead-961c-f58ef1adaa04
ORGANIZATION_ID=f_ecom_ZZKC_001
SHORT_CODE=kv7kzm78
SITE_ID=RefArch

I have made changes in next.config.js to change the connector name as mentioned in github steps.

after all these steps when I try to start it by "npm start" I am getting the above error.

from react-storefront.

dijs avatar dijs commented on May 22, 2024

Very odd... I just used a Windows machine to test this as well and I am still not getting this error.

What version of Windows are you running?

And it seems like your SFCC permissions are not quite correct for the API. I am not able to create a token.

from react-storefront.

asadkhawaja1 avatar asadkhawaja1 commented on May 22, 2024

change ORGANIZATION_ID to f_ecom_zzkc_001 and you will get the token.

I am using windows 10.

I have found that the reason behind this error might be the node version doesnโ€™t support ES6 export syntax.

Can you plz mention what version of node, npm and next are required for this connector??

from react-storefront.

dijs avatar dijs commented on May 22, 2024

@asadkhawaja1 I installed the exact version of node you were using. I used nvm-windows to install it.

from react-storefront.

asadkhawaja1 avatar asadkhawaja1 commented on May 22, 2024

@dijs I am now able to start the APP but when I hit http://127.0.0.1:3000/ I get below error in terminal

Fetching https://kv7kzm78.api.commercecloud.salesforce.com/product/shopper-products/v1/organizations/f_ecom_zzkc_001/categories/root?siteId=RefArch&levels=2
Fetching https://kv7kzm78.api.commercecloud.salesforce.com/product/shopper-products/v1/organizations/f_ecom_zzkc_001/categories/root?siteId=RefArch&levels=2
client status Forbidden
Error: {"type":"https://api.commercecloud.salesforce.com/documentation/error/v1/errors/forbidden","title":"Forbidden","detail":"Your shopper JWT is valid, but you have no permissions to access the resource."}
at fetchWithToken (D:\Work\Salesforce\Sample Apps\sfcc-connector.next\server\pages\api.js:918:15)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async createAppData (D:\Work\Salesforce\Sample Apps\sfcc-connector.next\server\pages\api.js:1141:7)
at async Promise.all (index 1)

Could not connect to backend https://zzkc-001.sandbox.us01.dx.commercecloud.salesforce.com/on/demandware.store/Sites-RefArch-Site: getaddrinfo ENOTFOUND
error

Can you plz have a look and tell what am I doing wrong?

Even in postman when I hit for
https://{{shortCode}}.api.commercecloud.salesforce.com/product/shopper-products/v1/organizations/{{organizationId}}/categories/root?siteId=RefArch&levels=2

I get

{"type":"https://api.commercecloud.salesforce.com/documentation/error/v1/errors/forbidden","title":"Forbidden","detail":"Your shopper JWT is valid, but you have no permissions to access the resource."}

from react-storefront.

dijs avatar dijs commented on May 22, 2024

It looks like the page cannot be rendered because the API could not fetch the required data. Most likely the list of categories. Seems like you are still having permissions issues.

Yes, it is trying to pull categories:

https://kv7kzm78.api.commercecloud.salesforce.com/product/shopper-products/v1/organizations/f_ecom_zzkc_001/categories/root?siteId=RefArch&levels=2

But this is failing because your API token does not have access to them. Please add the needed permissions to your API token and it should work fine.

from react-storefront.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.