www/apps/cloud/app/deployments/troubleshooting/page.mdx
export const metadata = {
title: Troubleshooting Cloud Deployments,
}
In this guide, you'll find solutions to common issues that may arise when deploying your Medusa applications on Cloud.
When a deployment fails, you can see the build and runtime logs of your deployment to understand the cause of the failure.
Alternatively, you can install the Cloud CLI and use it to check logs from your terminal or with the help of AI agents like Claude Code.
For example:
# Install the CLI
npm install @medusajs/mcloud -g
# Login
mcloud login
# Check logs of the latest deployment in the environment
mcloud logs --organization org_123 --project proj_123 --environment env_123
# Check logs of a specific deployment
mcloud logs --organization org_123 --project proj_123 --environment env_123 --deployment-id deploy_123
See the Cloud CLI guide for more details on how to use the CLI to manage your Cloud resources and deployments.
Before deploying your Medusa application on Cloud, Medusa runs the build script defined in your package.json file, then copies only the output of the build process, which is the .medusa/server directory.
The .medusa/server directory holds the compiled JavaScript files of your project, the production build of the admin dashboard, and other necessary files to run your Medusa application in production.
If you have custom files needed at runtime, such as a src/data directory that holds JSON files, modify the build script in your package.json file to copy these files to the .medusa/server directory after the build process.
For example:
{
"scripts": {
"postbuild": "cp -r src/data .medusa/server/src/data",
"build": "medusa build && npm run postbuild"
}
}
This script copies the src/data directory to the .medusa/server directory following the build process.
Learn more in the Deployments Guide.
<Note>You can replace npm run postbuild with the appropriate command for your package manager, such as yarn postbuild.
To troubleshoot other Cloud deployment issues, you can: