0

I have provisioned a Linux P1V3 app service plan and created an app service. It is running NodeJS 20. All this is via Terraform. A developer has given me their NextJS website repo which uses pnpm, turbo-repo (not sure what those things are except that pnpm is new npm). I configured another pipeline to install required packages, run pnpm build and create zip archive from the output of the build, which is static site (it is in proper apps/*/out/ folder). I have used AzureRmWebAppDeployment@5 task to deploy the zip archive. But when I navigate to the site, it shows default start page. I have also used az webapp deploy to deploy the zip file from my machine but still the same results.

Will anyone be able to point what obvious thing I'm missing here?

Also, can't use static-site as that is not available in allowed region yet.

I'm willing to try a function app if that makes running this easier.

EDIT:- Made the az webapp deploy work after fixing base path in some nextjs settings file before compiling. But deploying via pipeline still not working.

4
  • App Service is the right choice. By the way, what do you mean by "static site"? Does it start from an HTML file, or does it require a Node server? Normally, App Service needs a Startup Command, where you specify how to start your server after deployment. Try running your server locally first to see what steps are needed, then replicate those steps in the cloud. Commented Apr 9 at 4:07
  • @TheVillageIdiot Can you please share the DevOps yml file. Commented Apr 9 at 5:04
  • @Duannx Not static site it is App Service. The site does not need node server as it is compiled by next.js to static HTML/JS site like good ol' days Commented Apr 13 at 11:52
  • @AsleshaKantamsetti It is using standard pipeline task. I can verify the artifacts I'm trying to deploy by downloading the zip and seeing it has all the correct files. Commented Apr 13 at 11:53

1 Answer 1

0

when I navigate to the site, it shows default start page. I have also used az webapp deploy to deploy the zip file from my machine but still the same results.

I created a sample Next.js app, zipped the out folder and deployed it to an Azure Web App using az webapp deploy from my local machine.

Even I faced the same issue after deploying my Web App, and I was able to resolve it by adding below startup command in the Configuration section of the Azure Web App.

pm2 serve /home/site/wwwroot/out --no-daemon --spa

enter image description here

Make sure next.config.mjs file contains output: 'export', line.

next.config.mjs:

/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  output: 'export',
 },
module.exports = nextConfig

Azure Output:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

@TheVillageIdiot Please check if the solution Above helped you. Let me know if there's anything else I can assist with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.