Closed colinscz closed 7 months ago
Update, I partially resolved this by creating a new static web app and using the YAML created out of the box instead of my configuration.
Instead of
- stage: deploy_staging
displayName: Deploy Staging
jobs:
- deployment: deploy
displayName: Deploy and test
environment: Staging
variables:
- group: Azure-Static-Web-Apps-xxxx-variable-group
strategy:
runOnce:
deploy:
steps:
- download: none
- checkout: none
- download: current
artifact: nextApp
- task: AzureStaticWebApp@0
displayName: Deploy to staging environment
inputs:
workingDirectory: $(Pipeline.Workspace)/nextApp
output_location: "/out"
skip_app_build: true
skip_api_build: true
is_static_export: false
verbose: true
azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN)
deployment_environment: staging
that part of the pipeline now looks like this:
- stage: deploy_staging
displayName: Deploy Staging
jobs:
- deployment: deploy
displayName: Deploy and test
environment: Staging
variables:
- group: Azure-Static-Web-Apps-xxxx-variable-group
strategy:
runOnce:
deploy:
steps:
- download: none
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
displayName: Deploy to staging environment
inputs:
output_location: ""
verbose: true
azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN)
deployment_environment: staging
I got rid of the following props:
After that I also had to add the standalone prop to next.config.js as described here: https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-hybrid#configure-your-nextjs-app-for-deployment-to-static-web-apps
Issues I am left with, which I guess aren't related to Azure SWA unless the app dir approach has something to do with it:
Update: I executed the project successfully in prod mode in local after doing the manual step of copying over static and public folder to the standalone directory as per Next.js docs: https://nextjs.org/docs/app/api-reference/next-config-js/output#automatically-copying-traced-files
However when I deploy it to Azure and access the homepage/index available under the locale
After syncing with some colleagues from our internal Azure unit I found out that with the current setup I am unable to attach logging to the created Azure Function as part of this blueprint (seems its not editable) nor see any application insights on the Azure portal itself....
This issue is most likely the same as described in #1196
This issue is most likely the same as described in #1196
I'm having the same issue, did you figure it out? I'm trying to deploy my personal portfolio site on azure
I was also able to deploy a new project under SWA for a couple weeks, but as soon as we started using Middleware
, i18n, AuthX and calling an external API, things started to crash - when using standalone
(the recommended way).
There are all the "manual" steps of copying things around into the standalone folder, still seems to not function properly.
I tried locally doing node server.js
and it worked, still can't seem to run this nicely, especially in SWA.
Perhaps the way to go is with a container or so. 🤷🏾♂️
If you figure it out, please update here. I'll do same.
Hey folks! We released significant improvements to our Next.js support on Static Web Apps, check out the announcement in #1428. Closing this thread as it's resolved now!
Describe the bug
Hi guys,
When I want to deploy my Next.js SSR app the build fails due to a missing index.html. I went through the following resources but couldn't find something regarding the issue I face.
The production build goes through without errors and it seems the static pages and the dynamic page setup is done correctly. If I am not mistaken the index.html file would be required for the use case of Static Site Generation with
next build && next export
. In my case I only usenext build
since I want to go with Server Side Rendering.variables: isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')] isDevelop: $[eq(variables['Build.SourceBranch'], 'refs/heads/develop')]
pr: branches: include:
stages:
stage: Build jobs:
job: build displayName: Build project steps:
task: Cache@2 displayName: 'Cache .next/cache' inputs: key: next | $(Agent.OS) | package-lock.json path: '$(System.DefaultWorkingDirectory)/.next/cache'
task: NodeTool@0 inputs: versionSpec: '16.x' displayName: 'Install Node.js'
script: | npm install npm run build displayName: Build nextJs App
publish: $(Build.SourcesDirectory)/.next artifact: nextApp displayName: Publish nextJs App Bundle
stage: deploy_staging displayName: Deploy Staging jobs: