sotocast
sotocast

Reputation: 102

How to deploy React Native web app using Expo in Node JS Azure - App Service

When I deploy the application in Azure with Visual Studio Code, I get the following error stack:

2020-10-28T20:34:32.249Z INFO - Initiating warmup request to container appdemo_xxxxxx for site appdemo_xxxxxx 2020-10-28T20:34:37.841Z ERROR - Container appdemo_xxxxxx for site appdemo_xxxxxx has exited, failing site start 2020-10-28T20:34:37.844Z ERROR - Container appdemo_xxxxxx didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging. 2020-10-28T20:34:37.874Z INFO - Stopping site appdemo_xxxxxx because it failed during startup.

The Plan de App Service is a SO Linux.

If I change start in package.json to "node index.js" work fine, but if I use this, not work:

 "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest --watchAll"
  },

I have created the variables in Configuration -> App Settings PORT = 8080 and WEBSITES_PORT = 80

What am I doing wrong?

Upvotes: 2

Views: 1772

Answers (2)

sotocast
sotocast

Reputation: 102

I found the solution for this error:

  1. Export the project from the VS terminal: expo build:web --no-pwa
  2. Transfer it using FTP to Azure
  3. Ready!

Upvotes: 1

Ryan Hill
Ryan Hill

Reputation: 1942

Remove the PORT setting and change your WEBSITES_PORT to 8080. The start command should be picked up from your "start" script in your package.json. If that isn't working, you can try setting npm expo start as a start-up command under Application Settings blade in the portal or use Azure CLI command az webapp config set --resource-group <resource-group-name> --name <app-name> --startup-file "npm expo start". Also make sure your expo dependencies are being installed correctly. You should be able to verify in your deployment logs. If not, you can customize a pre-startup batch command to run your necessary npm install command.

Upvotes: 0

Related Questions