Search code examples
postgresqlazurestrapiazure-appservice

How to deploy Strapi V5 to Azure App Services


The steps I have taken are as follows:

  1. I created a web app with linux and node 20 lts with my code deployed from deployment center and github that has strapi saved in a repo.

  2. I have created a postgresSQL flexible server with public access enabled in network tab and no firewall rules. Database name testdb, user is testadmin, and then a password

  3. I have created a storage account and a storage container with Anonymous access level = blob. I have saved the access key1 in the env variable described in next step.

  4. I have added 6 environment variables to my web app for:

    STORAGE_ACCOUNT = storageaccountname STORAGE_ACCOUNT_CONTAINER = storagecontainername STORAGE_ACCOUNT_KEY = key from above DATABASE_HOST = testdb.postgres.database.azure.com DATABASE_PASSWORD = secret DATABASE_USERNAME = testadmin

All the web page loads to say is : :( Application Error If you are the application administrator, you can access the diagnostic resources.

I am not sure what I am missing from this deployment. Is it not possible to do strapi v5 in app services?

My strapi plugin config looks like this for the blob storage:

    module.exports = ({ env }) => ({
    upload: {
      config: {
        provider: "strapi-provider-upload-azure-storage",
        providerOptions: {
          account: env("STORAGE_ACCOUNT"),
          accountKey: env("STORAGE_ACCOUNT_KEY"),//either account key or sas token is enough to make authentication 
          containerName: env("STORAGE_CONTAINER_NAME"),
          defaultPath: "assets",
        },
      },
    },
  });

and my database config looks like this:

import path from 'path';

export default ({ env }) => {
  const client = env('DATABASE_CLIENT', 'sqlite');

  const connections = {
    mysql: {
      connection: {
        host: env('DATABASE_HOST', 'localhost'),
        port: env.int('DATABASE_PORT', 3306),
        database: env('DATABASE_NAME', 'strapi'),
        user: env('DATABASE_USERNAME', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        ssl: env.bool('DATABASE_SSL', false) && {
          key: env('DATABASE_SSL_KEY', undefined),
          cert: env('DATABASE_SSL_CERT', undefined),
          ca: env('DATABASE_SSL_CA', undefined),
          capath: env('DATABASE_SSL_CAPATH', undefined),
          cipher: env('DATABASE_SSL_CIPHER', undefined),
          rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
        },
      },
      pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
    },
    postgres: {
      connection: {
        connectionString: env('DATABASE_URL'),
        host: env('DATABASE_HOST', 'localhost'),
        port: env.int('DATABASE_PORT', 5432),
        database: env('DATABASE_NAME', 'strapi'),
        user: env('DATABASE_USERNAME', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        ssl: env.bool('DATABASE_SSL', false) && {
          key: env('DATABASE_SSL_KEY', undefined),
          cert: env('DATABASE_SSL_CERT', undefined),
          ca: env('DATABASE_SSL_CA', undefined),
          capath: env('DATABASE_SSL_CAPATH', undefined),
          cipher: env('DATABASE_SSL_CIPHER', undefined),
          rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
        },
        schema: env('DATABASE_SCHEMA', 'public'),
      },
      pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
    },
    sqlite: {
      connection: {
        filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
      },
      useNullAsDefault: true,
    },
  };

  return {
    connection: {
      client,
      ...connections[client],
      acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
    },
  };
};

Log stream after updating package.json and adding startup command:

    Connected!
2024-09-10T23:30:17  Welcome, you are now connected to log-streaming service.Starting Log Tail -n 10 of existing logs ----/home/LogFiles/__lastCheckTime.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/__lastCheckTime.txt)09/10/2024 23:27:19/home/LogFiles/kudu/trace/01a24e93fcc1-9ee06e77-7adf-4824-8c53-10dec00c8a1c.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/01a24e93fcc1-9ee06e77-7adf-4824-8c53-10dec00c8a1c.txt)
2024-09-06T01:55:57  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 86,1,5, ScmType: None/home/LogFiles/kudu/trace/2fbdd76cb83d-299ef8a9-de91-45e6-8a0c-898e6f5c5563.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/2fbdd76cb83d-299ef8a9-de91-45e6-8a0c-898e6f5c5563.txt)
2024-09-07T12:58:19  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 86,1,28, ScmType: GitHubAction/home/LogFiles/kudu/trace/3fbadc99f6f2-6abcbf8e-d8fd-422a-b054-98350f9067d4.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/3fbadc99f6f2-6abcbf8e-d8fd-422a-b054-98350f9067d4.txt)
2024-09-08T02:11:46  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 87,1,27, ScmType: GitHubAction/home/LogFiles/kudu/trace/4a1314a0cdfa-1e3287db-d688-4929-b629-9d089beece5f.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/4a1314a0cdfa-1e3287db-d688-4929-b629-9d089beece5f.txt)
2024-09-07T21:10:33    Outgoing response, type: response, statusCode: 409, statusText: Conflict/home/LogFiles/kudu/trace/4a1314a0cdfa-2ee85573-d4ad-490a-b49d-df2fbdeb2fc7.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/4a1314a0cdfa-2ee85573-d4ad-490a-b49d-df2fbdeb2fc7.txt)
2024-09-07T21:13:36    Outgoing response, type: response, statusCode: 409, statusText: Conflict/home/LogFiles/kudu/trace/4a1314a0cdfa-7ac4bbe3-e5db-4854-b3dd-fee1a6897788.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/4a1314a0cdfa-7ac4bbe3-e5db-4854-b3dd-fee1a6897788.txt)
2024-09-07T21:11:47    Outgoing response, type: response, statusCode: 409, statusText: Conflict/home/LogFiles/kudu/trace/4a1314a0cdfa-8533bbe1-aaa5-41b0-8aae-428ad5137579.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/4a1314a0cdfa-8533bbe1-aaa5-41b0-8aae-428ad5137579.txt)
2024-09-07T21:11:06    Outgoing response, type: response, statusCode: 409, statusText: Conflict/home/LogFiles/kudu/trace/4a1314a0cdfa-b716bf15-9018-43c2-b942-6b49530aa124.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/4a1314a0cdfa-b716bf15-9018-43c2-b942-6b49530aa124.txt)
2024-09-07T21:12:40    Outgoing response, type: response, statusCode: 409, statusText: Conflict/home/LogFiles/kudu/trace/4a1314a0cdfa-d24a2951-9d87-4758-a875-3f457bee6bc6.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/4a1314a0cdfa-d24a2951-9d87-4758-a875-3f457bee6bc6.txt)
2024-09-07T20:50:14  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 86,1,25, ScmType: GitHubAction/home/LogFiles/kudu/trace/7e1cd208f0b4-e1370fcb-66f8-4f4c-89bc-4624da8b9c5f.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/7e1cd208f0b4-e1370fcb-66f8-4f4c-89bc-4624da8b9c5f.txt)
2024-09-10T23:30:16  Startup Request, url: /api/logstream/, method: GET, type: request, pid: 86,1,16, ScmType: GitHubAction/home/LogFiles/kudu/trace/9ac1ae425e76-584c7aec-d992-4c25-80db-38888d57e409.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/9ac1ae425e76-584c7aec-d992-4c25-80db-38888d57e409.txt)
2024-09-07T22:43:51  Startup Request, url: /api/settings, method: GET, type: request, pid: 87,1,5, ScmType: GitHubAction/home/LogFiles/kudu/trace/a4c18325dbb6-11d7e3d6-7136-419e-b0cb-0398901e0eea.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/a4c18325dbb6-11d7e3d6-7136-419e-b0cb-0398901e0eea.txt)
2024-09-09T01:31:14  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 87,1,5, ScmType: GitHubAction/home/LogFiles/kudu/trace/bc0adb4932c3-0b31d439-06b1-4e29-b702-96a4d2dc9669.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/bc0adb4932c3-0b31d439-06b1-4e29-b702-96a4d2dc9669.txt)
2024-09-09T10:44:38  Startup Request, url: /api/settings, method: GET, type: request, pid: 86,1,7, ScmType: GitHubAction/home/LogFiles/kudu/trace/d161c5265d14-10702da1-9350-49db-bcd8-2b1a39b36a25.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/d161c5265d14-10702da1-9350-49db-bcd8-2b1a39b36a25.txt)
2024-09-09T01:21:58  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 91,1,19, ScmType: GitHubAction/home/LogFiles/kudu/trace/d16ee7fe94b1-3f010105-018f-4f90-b184-b93219fb4b87.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/d16ee7fe94b1-3f010105-018f-4f90-b184-b93219fb4b87.txt)
2024-09-08T13:30:53  Startup Request, url: /api/settings, method: GET, type: request, pid: 87,1,34, ScmType: GitHubAction/home/LogFiles/kudu/trace/dbe4cfee1f4a-d44eb0fc-06dd-41ab-a86c-76918db9e310.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/dbe4cfee1f4a-d44eb0fc-06dd-41ab-a86c-76918db9e310.txt)
2024-09-06T03:04:21  Startup Request, url: /api/deployments/?api-version=2022-03-01, method: GET, type: request, pid: 87,1,7, ScmType: GitHubAction/home/LogFiles/kudu/trace/f34ce5425623-aa236c2b-bea0-4c98-88e5-aa1c6a4a9af5.txt  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace/f34ce5425623-aa236c2b-bea0-4c98-88e5-aa1c6a4a9af5.txt)
2024-09-08T01:49:02  Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 86,1,17, ScmType: GitHubAction/home/LogFiles/2024_09_06_lw1sdlwk0000JP_default_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_06_lw1sdlwk0000JP_default_docker.log)
2024-09-06T11:33:33.582231239Z }
2024-09-06T11:33:33.582234239Z
2024-09-06T11:33:33.582237139Z Node.js v20.15.1
2024-09-06T11:33:33.611503126Z npm http fetch GET 200 https://registry.npmjs.org/npm 537ms
2024-09-06T11:33:33.622487708Z npm notice
2024-09-06T11:33:33.622512409Z npm notice New minor version of npm available! 10.7.0 -> 10.8.3
2024-09-06T11:33:33.622517709Z npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
2024-09-06T11:33:33.622521309Z npm notice To update run: npm install -g [email protected]
2024-09-06T11:33:33.622524609Z npm notice/home/LogFiles/2024_09_06_lw1sdlwk0000JP_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_06_lw1sdlwk0000JP_docker.log)
2024-09-06T11:32:57.388Z ERROR - Container mosaic-strapi-web-app_0_57d4593f didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-06T11:32:57.450Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup.
2024-09-06T11:33:04.712Z INFO  - Starting container for site
2024-09-06T11:33:04.713Z INFO  - docker run -d --expose=8080 --name mosaic-strapi-web-app_0_c1f6f484 -e WEBSITE_USE_DIAGNOSTIC_SERVER=true -e WEBSITE_SITE_NAME=Mosaic-Strapi-web-app -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=mosaic-strapi-web-app-csagdmatfnepdfgd.eastus-01.azurewebsites.net -e WEBSITE_INSTANCE_ID=978cd1806fe99a7fba8b407448cdbad2eee49d1dce1d7c99273bab045481966c -e NODE_OPTIONS=--require /agents/nodejs/build/src/Loader.js appsvc/node:20-lts_20240819.2.tuxprod
2024-09-06T11:33:04.714Z INFO  - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2024-09-06T11:33:13.239Z INFO  - Initiating warmup request to container mosaic-strapi-web-app_0_c1f6f484 for site mosaic-strapi-web-app
2024-09-06T11:33:34.309Z ERROR - Container mosaic-strapi-web-app_0_c1f6f484 for site mosaic-strapi-web-app has exited, failing site start
2024-09-06T11:33:34.384Z ERROR - Container mosaic-strapi-web-app_0_c1f6f484 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-06T11:33:34.504Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup./home/LogFiles/2024_09_07_lw1sdlwk0000JP_default_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_07_lw1sdlwk0000JP_default_docker.log)
2024-09-07T22:06:53.105410877Z }
2024-09-07T22:06:53.105413877Z
2024-09-07T22:06:53.105416878Z Node.js v20.15.1
2024-09-07T22:06:53.115455968Z npm http fetch GET 200 https://registry.npmjs.org/npm 414ms
2024-09-07T22:06:53.118367294Z npm notice
2024-09-07T22:06:53.118383794Z npm notice New minor version of npm available! 10.7.0 -> 10.8.3
2024-09-07T22:06:53.118388394Z npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
2024-09-07T22:06:53.118391994Z npm notice To update run: npm install -g [email protected]
2024-09-07T22:06:53.118395194Z npm notice/home/LogFiles/2024_09_07_lw1sdlwk0000JP_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_07_lw1sdlwk0000JP_docker.log)
2024-09-07T20:50:49.696Z ERROR - Container mosaic-strapi-web-app_0_3e8b3cdb didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-07T20:50:49.732Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup.
2024-09-07T22:06:28.328Z INFO  - Starting container for site
2024-09-07T22:06:28.338Z INFO  - docker run -d --expose=8080 --name mosaic-strapi-web-app_0_d39caed9 -e WEBSITE_USE_DIAGNOSTIC_SERVER=true -e WEBSITE_SITE_NAME=Mosaic-Strapi-web-app -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=mosaic-strapi-web-app-csagdmatfnepdfgd.eastus-01.azurewebsites.net -e WEBSITE_INSTANCE_ID=978cd1806fe99a7fba8b407448cdbad2eee49d1dce1d7c99273bab045481966c -e NODE_OPTIONS=--require /agents/nodejs/build/src/Loader.js appsvc/node:20-lts_20240819.2.tuxprod
2024-09-07T22:06:28.340Z INFO  - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2024-09-07T22:06:35.193Z INFO  - Initiating warmup request to container mosaic-strapi-web-app_0_d39caed9 for site mosaic-strapi-web-app
2024-09-07T22:06:54.048Z ERROR - Container mosaic-strapi-web-app_0_d39caed9 for site mosaic-strapi-web-app has exited, failing site start
2024-09-07T22:06:54.071Z ERROR - Container mosaic-strapi-web-app_0_d39caed9 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-07T22:06:54.134Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup./home/LogFiles/2024_09_08_lw1sdlwk0000JP_default_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_08_lw1sdlwk0000JP_default_docker.log)
2024-09-08T15:12:51.416270880Z }
2024-09-08T15:12:51.445868078Z
2024-09-08T15:12:51.445904479Z Node.js v20.15.1
2024-09-08T15:12:51.467668593Z npm http fetch GET 200 https://registry.npmjs.org/npm 1073ms
2024-09-08T15:12:51.515959533Z npm notice
2024-09-08T15:12:51.515982934Z npm notice New minor version of npm available! 10.7.0 -> 10.8.3
2024-09-08T15:12:51.515988034Z npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
2024-09-08T15:12:51.516040035Z npm notice To update run: npm install -g [email protected]
2024-09-08T15:12:51.516140938Z npm notice/home/LogFiles/2024_09_08_lw1sdlwk0000JP_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_08_lw1sdlwk0000JP_docker.log)
2024-09-08T13:50:35.579Z ERROR - Container mosaic-strapi-web-app_1_370df979 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-08T15:12:11.507Z INFO  - Starting container for site
2024-09-08T15:12:11.701Z INFO  - docker run -d --expose=8080 --name mosaic-strapi-web-app_0_6b9c8c71 -e WEBSITE_USE_DIAGNOSTIC_SERVER=true -e WEBSITE_SITE_NAME=Mosaic-Strapi-web-app -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=mosaic-strapi-web-app-csagdmatfnepdfgd.eastus-01.azurewebsites.net -e WEBSITE_INSTANCE_ID=978cd1806fe99a7fba8b407448cdbad2eee49d1dce1d7c99273bab045481966c -e NODE_OPTIONS=--require /agents/nodejs/build/src/Loader.js appsvc/node:20-lts_20240819.2.tuxprod
2024-09-08T15:12:11.708Z INFO  - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2024-09-08T15:12:18.603Z INFO  - Initiating warmup request to container mosaic-strapi-web-app_0_6b9c8c71 for site mosaic-strapi-web-app
2024-09-08T15:12:43.061Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_6b9c8c71. Elapsed time = 24.4630682 sec
2024-09-08T15:12:53.302Z ERROR - Container mosaic-strapi-web-app_0_6b9c8c71 for site mosaic-strapi-web-app has exited, failing site start
2024-09-08T15:12:53.364Z ERROR - Container mosaic-strapi-web-app_0_6b9c8c71 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-08T15:12:53.533Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup./home/LogFiles/2024_09_09_lw1sdlwk0000JP_default_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_09_lw1sdlwk0000JP_default_docker.log)
2024-09-09T01:32:13.097796267Z }
2024-09-09T01:32:13.097799267Z
2024-09-09T01:32:13.097802267Z Node.js v20.15.1
2024-09-09T01:32:13.097805267Z npm http fetch GET 200 https://registry.npmjs.org/npm 2034ms
2024-09-09T01:32:13.110827554Z npm notice
2024-09-09T01:32:13.110853254Z npm notice New minor version of npm available! 10.7.0 -> 10.8.3
2024-09-09T01:32:13.110858354Z npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
2024-09-09T01:32:13.110861654Z npm notice To update run: npm install -g [email protected]
2024-09-09T01:32:13.110865054Z npm notice/home/LogFiles/2024_09_09_lw1sdlwk0000JP_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_09_lw1sdlwk0000JP_docker.log)
2024-09-09T01:27:54.681Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup.
2024-09-09T01:31:22.709Z INFO  - Starting container for site
2024-09-09T01:31:22.710Z INFO  - docker run -d --expose=8080 --name mosaic-strapi-web-app_0_b98e5619 -e WEBSITE_USE_DIAGNOSTIC_SERVER=true -e WEBSITE_SITE_NAME=Mosaic-Strapi-web-app -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=mosaic-strapi-web-app-csagdmatfnepdfgd.eastus-01.azurewebsites.net -e WEBSITE_INSTANCE_ID=978cd1806fe99a7fba8b407448cdbad2eee49d1dce1d7c99273bab045481966c -e NODE_OPTIONS=--require /agents/nodejs/build/src/Loader.js appsvc/node:20-lts_20240819.2.tuxprod
2024-09-09T01:31:22.718Z INFO  - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2024-09-09T01:31:32.845Z INFO  - Initiating warmup request to container mosaic-strapi-web-app_0_b98e5619 for site mosaic-strapi-web-app
2024-09-09T01:32:06.462Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_b98e5619. Elapsed time = 33.6164517 sec
2024-09-09T01:32:15.564Z ERROR - Container mosaic-strapi-web-app_0_b98e5619 for site mosaic-strapi-web-app has exited, failing site start
2024-09-09T01:32:15.633Z ERROR - Container mosaic-strapi-web-app_0_b98e5619 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-09T01:32:15.815Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup./home/LogFiles/2024_09_10_lw1sdlwk0000JP_default_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_10_lw1sdlwk0000JP_default_docker.log)
2024-09-10T23:29:36.319155840Z     at async Strapi.load (/home/site/wwwroot/node_modules/@strapi/core/dist/Strapi.js:315:5)
2024-09-10T23:29:36.319159240Z     at async Strapi.start (/home/site/wwwroot/node_modules/@strapi/core/dist/Strapi.js:207:9)
2024-09-10T23:29:36.319164840Z [2024-09-10 23:29:36.311] [32minfo[39m: Shutting down Strapi
2024-09-10T23:29:36.405347786Z npm http fetch GET 200 https://registry.npmjs.org/npm 532ms
2024-09-10T23:29:36.438963050Z npm notice
2024-09-10T23:29:36.439017051Z npm notice New minor version of npm available! 10.7.0 -> 10.8.3
2024-09-10T23:29:36.439023951Z npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
2024-09-10T23:29:36.439027852Z npm notice To update run: npm install -g [email protected]
2024-09-10T23:29:36.439031352Z npm notice/home/LogFiles/2024_09_10_lw1sdlwk0000JP_docker.log  (https://mosaic-strapi-web-app-csagdmatfnepdfgd.scm.eastus-01.azurewebsites.net/api/vfs/LogFiles/2024_09_10_lw1sdlwk0000JP_docker.log)
2024-09-10T23:27:57.269Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 24.4648587 sec
2024-09-10T23:28:13.357Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 40.5533194 sec
2024-09-10T23:28:30.930Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 58.1264806 sec
2024-09-10T23:28:46.536Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 73.7326647 sec
2024-09-10T23:29:03.506Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 90.7017848 sec
2024-09-10T23:29:19.033Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 106.2287263 sec
2024-09-10T23:29:34.884Z INFO  - Waiting for response to warmup request for container mosaic-strapi-web-app_0_56511357. Elapsed time = 122.0797233 sec
2024-09-10T23:29:37.006Z ERROR - Container mosaic-strapi-web-app_0_56511357 for site mosaic-strapi-web-app has exited, failing site start
2024-09-10T23:29:37.050Z ERROR - Container mosaic-strapi-web-app_0_56511357 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2024-09-10T23:29:37.087Z INFO  - Stopping site mosaic-strapi-web-app because it failed during startup.Ending Log Tail of existing logs ---Starting Live Log Stream ---

Solution

  • I created a Strapi QuickStart app and deployed it to an Azure Web App.

    [ERROR] requireStack: [ '/home/site/wwwroot/node_modules/.bin/strapi' ] 2024-09-07T22:06:53.105410877Z: [ERROR] }

    The above error is because of that there might be a problem with the way Strapi is initialized or with missing dependencies.

    I added the below start script to the package.json.This helps that the correct Strapi start command is executed to launch the application.

    "start": "node node_modules/@strapi/strapi/bin/strapi.js start"
    

    Azure depends on the start script in package.json to know how to start your application after deployment. Without this script, your deployment might fail because the platform doesn't know how to launch the Strapi server.

    Below is my complete code of package.json.

    package.json:

    {
      "name": "my-strapi",
      "version": "0.1.0",
      "private": true,
      "description": "A Strapi application",
      "scripts": {
        "build": "strapi build",
        "deploy": "strapi deploy",
        "develop": "strapi develop",
        "start":  "node node_modules/@strapi/strapi/bin/strapi.js start",
        "strapi": "strapi"
      },
      "dependencies": {
        "@strapi/plugin-cloud": "5.0.0-rc.17",
        "@strapi/plugin-users-permissions": "5.0.0-rc.17",
        "@strapi/strapi": "5.0.0-rc.17",
        "better-sqlite3": "9.4.3",
        "react": "^18.0.0",
        "react-dom": "^18.0.0",
        "react-router-dom": "^6.0.0",
        "styled-components": "^6.0.0"
      },
      "devDependencies": {
        "@types/node": "^20",
        "@types/react": "^18",
        "@types/react-dom": "^18",
        "typescript": "^5"
      },
      "engines": {
        "node": ">=18.0.0 <=20.x.x",
        "npm": ">=6.0.0"
      },
      "strapi": {
        "uuid": "433de1cd-bb4d-420f-872d-f86c61ca41cc"
      }
    }
    

    Azure App Service Output:

    enter image description here

    enter image description here