web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

E-commerce React props.context.app returns {"config":{},"routes":{}} even though app.settings.json has content

(0) ShareShare
ReportReport
Posted on by 5

Hi, I set up a local project using the https://github.com/microsoft/Msdyn365.Commerce.Online starter project. I have content in the app.settings.json file, however when I access the "app" property inside of props.context, both the "config" and "routes" are empty objects. Has anyone else experienced this? Is there a trick to expose this info?

I am on {"sdkVersion":"1.43.3","sskVersion":"9.40.24","retailServerProxyVersion":"9.40.1","node_runtime_version":"16"}

Steps taken to debug "props.context.app" returning "app: { config: {}, routes: {} }"

Ran "yarn build" to copy the latest "settings/app.settings.json" file into the build folder
I have read learn.microsoft.com/.../app-settings
I have tried Googling but not many links, only thing is pointing back to msdyn365 docs which I have read

I have the same question (0)
  • Brady Deal Profile Picture
    on at

    Hey Ken,

    Where exactly are you trying to access these props?  Also are they always empty objects or do they eventually get filled in?  BTW I was not able to reproduce this, if I drop a breakpoint in a module in the starter project it returns me everything in appsettings.  The other thing to check is to type ___initialData___.requestContext.app in the console window to see if it is being returned.

    Brady

  • Ken Walton Profile Picture
    5 on at

    Hi Brady,

    I appreciate your help. I had been trying to access the props.context.app properties inside of a component module and the config and routes would always be empty objects, even though in the app.settings.json (locally) there is lots of stuff.

    Now I tried running the console command you provided when visiting the index page and then in a module preview.

    https://localhost:4000/ will show config and routes with lots of properties inside of them, but not what I have in local app.settings.json, probably what is on actual live dev site that my env file points to. Does this sound right?

     localhost:4000/ [when I paste as url, and save post, it is truncated] modules?type=helloworld will show config {} and routes {} as empty objects.

    ---

    Update:

    I cloned new instance of https://github.com/microsoft/Msdyn365.Commerce.Online and did not update the .env file. Testing the preview localhost:4000/modules for the helloworld module returned negative result, same when testing default page mock https://localhost:4000/page?mock=default-page.

    After the above, I added the info to the .env file, ran  the page mock for default page and the preview for hello world and both returned config and routes as empty objects.

    But pointing browser to index page of https://localhost:4000/ and ___initialData___.requestContext.app in console window shows config, routes, contentSecurityPolicy, and platform all populated with values from remote dev server.

    I had expected to always see the local app.settings.json values, whether in a page, container, or content component. I am new to D365 (1 week with only training from the documentation on learn.microsoft.com/.../commerce-architecture)

  • Verified answer
    Brady Deal Profile Picture
    on at

    Hey Ken,

    First off adding the modules segment will never give you the app context since at that point you are rendering the module on its own.  

    What you need to do is create a mock page, which will give you the appContext, which you can change at anytime.  app.Settings.json is just the schema, the actual values are stored in the mock page or in SiteBuilder itself.

    Brady  

  • Ken Walton Profile Picture
    5 on at

    Thank you Brady! This is what I needed to learn.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Siv Sagar Profile Picture

Siv Sagar 283 Super User 2025 Season 2

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 213 Super User 2025 Season 2

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 152 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans