Like what we’re doing? Star us on GitHub!

Error deploying with Dockerfile / Azure App Services / DevOps

3 weeks ago

I've got a DevOps pipeline configured to deploy Payload to a Linux Azure App Service.

The deployment completes successfully and I can see the application files on the app-service, including







I get the error

error: cannot find module 'express'

when the app service tries to run

npm run serve


If I add the environment variable


to the app service I then get a different error,

error: cannot find module '..'




Any ideas?

Ok, so it seems to be an issue with Azure App Service deployments.

There are two issues I’m having.

1. Because I’m building in DevOps and then using ZipDeploy, the


environment variables from the App Service aren’t available to the admin. This is impacting being able to load the admin at all because I’m using such a variable for the server url.

2. App Service deployments seem to break the symlinks that

npm install

creates in the


folder. This means that I can’t re-run the

npm run build

command as part of the App Service start command.

3. Setting the public env vars in the build script on DevOps has no effect.


npm rebuild

on the app service fails due to permissions errors

Has anyone managed to get Payload working on Azure App Service at all?

  • danielmlr
    2 weeks ago

    Trying aswell, no luck as of now.

  • Kyr
    2 weeks ago

    I've made progress.... I'm using DevOps to build & publish the docker image to Azure Container Registry and booting the app service from the created docker image.

    This has bypassed all of the symlink nonsense but now when I go to


    I get the following error in my browser console:

    Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See for tips about how to debug and fix this problem.

    Error deploying with Dockerfile

    I think I finally solved it... Adding the following to my package.json fixed the react error. It seems that the default dependencies that Payload comes with have some differing versions of react dependencies within them 😦

    "overrides": {
      "react": "18.2.0"

    Error deploying with Dockerfile / Azure App Services / DevOps

    @danielmlr FYI

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More