Example Deployment with Now v1

This deployment example refers to the Now serverless deployment, specifically deployments using Docker containers.

This example refers to Now v1, which has been deprecated. If you are looking for Now v2, check out the Now v2 example.


Before you get started, you need to have:

We're going to deploy the application under the domain

The domain is already in use. Pick a different one if you choose to deploy using Now.


The first thing to do is to define a now.json file to configure the deployment with the following JSON:

"version": 1,
"public": true,
"name": "mc-examples-starter",
"alias": "mc-examples-starter",
"regions": ["bru"],
"files": ["dist", "headers.json", "", "now.json", "package.json"]

Some fields may vary based on your setup and requirements, for example public, regions, etc.

The files field determines the list of files for uploading to the cloud servers. The file, contains the configuration for production use, to differentiate it from the env.json used for development.

Next, we need to create an file with the following JSON:

"applicationName": "mc-examples-starter",
"frontendHost": "",
"mcApiUrl": "",
"location": "gcp-eu",
"env": "production",
"cdnUrl": "",
"servedByProxy": true

We also need a to whitelist the domains for the Content Security Policy:

"csp": {
"script-src": [""],
"connect-src": [
"style-src": [""]

As a next step, we need a Dockerfile which contains the runtime configuration for starting the HTTP server:

FROM node:10-stretch
COPY ./dist /app/dist
COPY ./package.json /app/
RUN yarn install --production
COPY ./csp.json /app/
COPY ./ /app/
ENV NODE_ENV=production
CMD /app/node_modules/.bin/mc-http-server --config /app/ --csp /app/csp.json --use-local-assets

For the sake of the example, the setup includes the static assets within the HTTP server as described here. For real production use we recommend uploading static assets to a CDN or Cloud Storage as described here.

We also assume that the assets are built first with yarn build and then copied into the Docker image (COPY ./dist /app/dist).


Finally, we can trigger the deployment using the Now CLI:

yarn build
now alias

Now deploy - part 1 Now deploy - part 2 Now alias

After changing to we can see the application loading and inspect the Developer Console to see that the configuration is correct:

Now deployed

However, if you try to log in, you will get an error:

Now login failed

This is expected. The domain is not allowed by the CORS rules defined in the Merchant Center API Gateway. It's a security measure as the Custom Application should only be served behind the Merchant Center proxy.

Now you're ready to Register your Custom Application and start using it!

Developer Center
HTTP APIGraphQL APIBETAPlatform Release NotesCustom ApplicationsBETASDKs & Client LibrariesImport & Export ToolsSUNRISE Starter FrontendsTutorialsFAQ
Merchant Center
DocumentationRelease Notes
Copyright © 2020 commercetools