System Information
- Strapi Version: 4.1.8
- Operating System: Windows
- Database: MySql
- Node Version: 14.18.1
- NPM Version: 6.14.15
- Yarn Version:
Hello,
As a proof of concept, I’m trying to deploy Strapi to an Azure app service and I can’t seem to get it working. I’m hoping someone has run into this or can point me in the right direction.
TLDR; the deployed quickstart app to an Azure app service is returning a 500.1001 error with no information in the application logs.
Starting from the quickstart project, I followed the guide I found here, although I had to make some adjustments. Here’s what I have done so far:
- Originally I had selected Linux for the OS of the app service. I had set up my app service to be deployed from a git repository in AzDO, but when the deploy ran, it encountered a bunch of timeout errors when trying to build. I saw reference to this in another post on the forums but I didn’t see any resolution. I created a new app service with Windows as the OS and this seemed to have allowed it to grab the needed modules.
- This subsequently failed with a message that
strapi was not recognized as a command
. I updated the “scripts” property ofpackage.json
to be:"strapi": "node node_modules/@strapi/strapi/bin/strapi.js start"
. This is a slightly different path from what is in the guide here. I don’t know if this was correct, but this is where I found thestrapi.js
- The git deployment automatically creates a
web.config
file which is looking for a server.js I had to add aserver.js
file at the root which is covered in the deploy documentation - At this point I tried browsing to https://.azurewebsites.net/ and got an error about not being able read a config due to the sharp library. I tried several things to resolve this using the kudu console including trying the notes in the error message:
npm install --platform=win32 --arch=x64 sharp
. Eventually I deleted thenode_modules
folder, deleted thepackage.lock
and then runningnpm install
. - Calling the endpoint again resulted in an error and from the app service logs I could see an error about config values being blank. I basically took the values from the
.env
file and added them as app settings in the app service and then added the database connection information as app settings - Now when I browse to the app service url, I can see what I think is the node app starting up in the logs; I see the message that says
One more thing...Create your first administrator 💻 by going to the administration panel at:
. . . But nothing else shows in the log and in the browser a 500.1001 error is returned. According to the Microsoft docs, a 1001 sub error means that the app is not responding on the url. - Since the HOST value was 0.0.0.0 I tried updating this to the app service host instead, but this didn’t change anything. I instead updated the
config/server.js
to include a url property that had the url of the app service and reverted the HOST value back to 0.0.0.0. - Based on the error message I thought something might be wrong with the port, which I left as the default 1337. I searched for some answers and saw for other node apps that valid ports are 80 and 443, but when I tried setting the environment variable to either for these values I got a permission denied error in the logs when the app tried to start up and ended up switching the PORT value back to 1337.
At this point I’m pretty stuck. I’ve turned on verbose logging on the app service, but I’m not seeing anything in the logs beyond the startup message and app insights doesn’t have anything. It “seems” like the node app is running but for whatever reason the request is getting to the app. I know that the environment variables/app settings are being read since I can change them to invalid values and get different error messages.
Any help would be appreciated, thanks!