Skip to main content



No record found.

Dynamics 365 Community / Forums / Commerce forum / Is it possible to run ...
Commerce forum
Suggested answer

Is it possible to run your Ecom dev env against a locally hosted VM (Onebox) ?

Posted on by 285

I've been able to run the ecommerce development against a Cloud Hosted Environment by modifying the .env file.

Then I tried to do the same using a locally hosted OneBox VM, but I have been unable to get it to work.

Does anyone know if this is even possible?

I'm getting the below error when trying to access localhost:4000: (note the url)


  • Suggested answer
    Sam Jarawan Profile Picture
    Sam Jarawan on at
    RE: Is it possible to run your Ecom dev env against a locally hosted VM (Onebox) ?

    Hi Rob, 

    To test against a cloud hosted environment you should be able to follow this doc: Configure an e-commerce development environment against a Commerce cloud environment - Commerce | Dynamics 365 | Microsoft Docs

    Note that the cloud hosted environment does not support e-Commerce, so if you want to connect to https://localhost:4000/ your .env file should be configured against your production e-commerce site.

    I'd recommend on your dev environment to only set the "MSDyn365_HOST" property (leave all other properties empty).  Then confirm you see your site when you navigate to https://localhost:4000/  then configure MSDyn365Commerce_BASEURL, MSDyn365Commerce_CHANNELID and MSDyn365Commerce_OUN.   

    Then restart node server "yarn start" and your prod site should render locally but now acquire data from your cloud hosted environment.  A good way to test, is make a product change or nav hierarchy change and once appropriate jobs have completed you should see results on your local dev environment.

    As for debugging against a VM, it's a bit more involved.  Below are the instructions I've pasted from the "E-Commerce Getting Started Guide" available on the Retail Insiders Yammer group.



    How to debug against a Retail Server VM dev environment

    This section will cover how to debug against a downloaded VM environment hosting the Commerce Scale Unit. The online SDK dev tools can be installed on the VM development environment directly.

    As seen in an earlier section, the .env file can be modified to point to any commerce scale unit to debug against.  We need to point it to the local box.

    Edit the .env file and fill in the MSDyn365Commerce_BASEURL property to point to the local Retail server.  The remainder properties should be configured to a desired channel.  See this doc for more information Configure a development environment (.env) file.







    Make sure to restart the Node.js server with “yarn start” to pick up these new values.  As you build modules and debug data actions, calls will now be made directly to the local Server.


    To solve CORS (cross origin) errors, you will also need to change the “AllowedOrigins” setting in the Retail service web.config to allow the call to go through:

    <add key="AllowedOrigins" value="*" />

    <!-- <add key="AllowedOrigins" value="">;https:/.../> -->


    Disable the e-Commerce Content Security Policy

    When accessing your e-Commerce site, since calls are going through to a different server, you will get CSP errors.  To fix this you need to disable the CSP from within the site builder tool.  Select the site and “Extensions” tab under the “Settings”.

    Next select the “Content security policy” tab at the top and ensure “Disable content security policy” is enabled.  Finally, you will need to select the “Save and publish” button to save this setting. 


    If you have the “MSDyn365_HOST” set to your e-Commerce site as explained in the earlier section of this guide, you can also navigate to https://localhost:4000 to view your online website rendered on the local Node.js server.  All Data Action Retail Server calls will be routed to the Tier 1 environment as specified in the .env file.


    Certificate errors

    Some VMs may not have certificates installed to allow https calls to go through to itself.  A work around is to run the freely available “Fiddler” tool.  Once Fiddler is installed, open the “Tools” -> “Options” menu and enable “Decrypt HTTPS traffic” from the HTTPS tab as shown below.


    With fiddler now running, opening the https://localhost:4000  should now load the e-commerce site and all Commerce scale unit calls will now be redirected to the local Retail Server.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,513 Super User

Martin Dráb Profile Picture

Martin Dráb 225,862 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans