Announcements
Composable Storefront Overview
Quick Start
Deploy Your Code
Skills for Success
Composable Storefront Specifications
B2C Commerce Release Notes
Ask the Community
To run your commerce application on Managed Runtime, you must first push a code bundle and deploy it to a target environment.
This guide shows you how to:
Before you can use Managed Runtime and Runtime Admin, ask your B2C Commerce administrator to add one of these roles to your account in Account Manager: Managed Runtime User or Managed Runtime Admin.
Important
If you already have a .mobify file in your home directory, you can skip this section.
Note
Before you can push a bundle, you must first authorize your computer.
Start the authorization process by looking up your personal API key:
For security, when you return to the Account Settings page, the API key isn’t displayed in full, so you must reset it to copy the full text of the API key again.
From the command line, go to your PWA Kit project directory and run the command that you copied.
Run the command again on any other computers that you want to use for pushing bundles.
Pushing a bundle involves running a script that packages up your code into a Webpack bundle and uploads it to the Runtime Manager.
Before pushing your first bundle, verify that the package.json file in your PWA Kit project directory is configured correctly:
my-project.name field in package.json.To ensure that your bundle works correctly when deployed, you must set your proxies on your environment in Runtime Admin.
If you are using a SLAS private client, you must set the client secret via an environment variable.
Projects generated from PWA Kit 3.5 and above will be configured to use a SLAS private client by default.
To learn more about using SLAS private clients, see Using A Slas Private Client.
Note
To push a bundle, go to the command line and run the following command from your project directory:
1npm run push -- -m "Message to help you recognize this bundle"For a list of other options you can supply to the push script, run npm run push -- --help.
When a bundle is successfully pushed, the message Beginning upload… appears in the terminal followed by the message Bundle Uploaded!.
If something went wrong, look for one three possible error messages (based on HTTP response status codes) in your terminal after the Beginning upload… message.
Here’s how to troubleshoot each error message.
An HTTP 404 error is returned in the terminal when a project does not exist with the name specified in package.json or when you are not authorized to change the project.
To fix the error:
my-project.package.json inside your project directory.name and projectSlug both match the project ID string that you copied.An HTTP 401 error is returned in the terminal when you do not have permission to push bundles. To fix this error, contact your B2C Commerce Account Manager administrator and ask to have your permission elevated to include pushing bundles.
An HTTP 413 error is returned in the terminal when your bundle is too large. The maximum size for bundles is 400 MB and the maximum size of all ssr_only and ssr_shared files within the bundle is 247 MB. To fix this error, check the size of your bundle by inspecting the build folder within your project. If your project is nearing the maximum size or has already exceeded it, here’s what you can do to reduce it:
After reducing the size of your project files, try pushing the bundle again.
HTTPS errors can occur when your local computer or network proxies like a corporate VPN or firewall have not been configured to communicate with Managed Runtime’s API, hosted at cloud.mobify.com.
These errors may include messages like unable to get local issuer certificate or self signed certificate in certificate chain.
To resolve these errors, work with your corporate IT team to configure your Node.js installation for your corporate network environment.
After you’ve successfully pushed a bundle, you can deploy it to a target environment.
For any site that uses PWA Kit and Managed Runtime, you can only designate one bundle at a time as deployed for each environment. By default, every project comes with a single environment, called production. You can create more environments using Runtime Admin or the Managed Runtime API.
To deploy a bundle:
When deployment has successfully completed, the bundle appears underneath the heading Deployed Bundle.
For your first deployment to a new environment, the process can take up to an hour to complete. Subsequent deployments take around a minute, unless changes to the CDN are required. A CDN change takes around 15 minutes and is required when the deployment contains changes to the request processor or proxy configuration.
Note