Articles in this section

Strapi constantly restarting in development environments (Restart Loop)

When tailing the logs of a Strapi application on a development environment, you may notice that the container is constantly trying to restart Strapi, even if the application UI appears to be running normally.

Cause

This issue is caused by a conflict between Strapi’s auto-reload file watcher and your mounted directories.

If your start command in .upsun/config.yaml or .platform.app.yaml is set to yarn develop or npm run develop (which executes strapi develop), Strapi actively watches your project directory for file changes so it can hot-reload the server.

On the platform, the file system is strictly read-only, except for your explicitly defined mounts (commonly public/uploads, .tmp, or a local SQLite database directory). During normal startup, Strapi often writes temporary files, logs, or database updates into these mounted directories.

The sequence becomes:

  1. Strapi starts.

  2. Strapi writes a file to a mounted directory (e.g., .tmp).

  3. The file watcher detects the change and triggers a restart.

  4. The loop repeats indefinitely.

Resolution

Option 1: Use Production Mode (Recommended)

The strapi develop command and its file watcher are intended for local development only. Remote environments—even development/staging branches on Upsun or Platform.sh—should run the compiled production build of your application.

Change your start command in your configuration file to use start instead of develop.

.upsun/config.yaml / .platform.app.yaml:

YAML

 
web:
    commands:
        start: "npm run start" # or yarn start, which triggers `strapi start`

(Note: Ensure your build hook includes npm run build so the admin UI is properly compiled before starting).

Option 2: Ignore Mounted Directories in the Watcher

If your workflow strictly requires running strapi develop on a remote environment, you must configure Strapi's Webpack/Vite file watcher to ignore your mounted directories.

Update your Strapi administration configuration file (typically config/admin.js or config/admin.ts) to include the watchIgnoreFiles array, targeting your platform mounts.

Example config/admin.js:

JavaScript

 
module.exports = ({ env }) => ({
  // ... other config
  watchIgnoreFiles: [
    '**/public/uploads/**',
    '**/.tmp/**',
    '**/data/**' // Add this if you use a mounted SQLite database
  ],
});

Commit and push this configuration change to break the restart loop.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.