Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The size of the function content was too large. The limit for this Static Web App is 104857600 bytes #1034

Closed
marnocha opened this issue Jan 11, 2023 · 32 comments
Assignees

Comments

@marnocha
Copy link

I'm getting this error on GitHub actions when trying to deploy a simple nextjs application to Azure Static Web Apps:
---End of Oryx build logs---
Function Runtime Information. OS: linux, Functions Runtime: ~4, node version: 16
Finished building function app with Oryx
Zipping Api Artifacts
Done Zipping Api Artifacts
The content server has rejected the request with: BadRequest
Reason: The size of the function content was too large. The limit for this Static Web App is 104857600 bytes.

I followed this guide:
https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-hybrid

I've moved all devdependencies to the proper section in my package.json:
"dependencies": {
"next": "13.1.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.7.1"
},
"devDependencies": {
"@types/node": "18.11.18",
"@types/react": "18.0.26",
"autoprefixer": "^10.4.13",
"eslint": "8.31.0",
"eslint-config-next": "13.1.1",
"postcss": "^8.4.21",
"sharp": "^0.31.3",
"tailwindcss": "^3.2.4",
"typescript": "4.9.4"
}

If I remove a couple images I can get it to build, but as the complexity of my app increases it hits the error. It works fine deploying to Vercel, but I would prefer to run it on Azure and use the supported hybrid (not just static site) features. Can you provide a solution or workaround to this issue that doesn't involve switching to static? Or fix this bug?

I know it isn't exactly related but I also am using the paid version of Azure static web apps so I can have larger projects, but that doesn't impact this bug as it seems the build process has a lower limit. Thank you!

@sachin-rathor
Copy link

Hi @marnocha,

Thanks for reaching out!

As a workaround you can try below steps:

  1. To reduce the app size, see if removing the cache folder helps by changing the build script on package.json to something like "build": "next build && rm -rf ./.next/cache". More details: Max app size seems different than reported by Oryx #769 (comment)
  2. For the 100MB limit, this is for NextJS Hybrid app, more details at https://learn.microsoft.com/en-us/azure/static-web-apps/nextjs#unsupported-features-in-preview

We are working on improving the experience. We'll let know about the future updates.

Thanks!

@marnocha
Copy link
Author

Thank you, the workaround works!

@infospry
Copy link

Hi,
Even adding build": "next build && rm -rf ./.next/cache". this line to package.json, still getting the same error
The content server has rejected the request with: BadRequest
Reason: The size of the function content was too large. The limit for this Static Web App is 104857600 bytes.
Please help me sort this issue as we are not able to deploy. Thanks

@infospry
Copy link

Hi @sulabh-msft @sachin-rathor please to fix this.

Even adding build": "next build && rm -rf ./.next/cache". this line to package.json, still getting the same error
The content server has rejected the request with: BadRequest
Reason: The size of the function content was too large. The limit for this Static Web App is 104857600 bytes.
Please help me sort this issue as we are not able to deploy. Thanks

@vivekjilla
Copy link

Hi @infospry Thanks for reaching out. Unfortunately, if the app is actually larger than 100MB due to dependent libraries in package.json, we don't have any workaround today other than figuring out the larger dependencies and remove them if possible.

But we're working in improving these limits and providing other options, but they're not available right now. Apologies for the inconvenience.

@infospry
Copy link

infospry commented Jan 18, 2023

Hi @vivekjilla please check package.json where we are using only basic dependencies but still its not going through even the entire app is about 2-3 mb excluding cache
{
"name": "jobs-app-employer",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 3300",
"build": "next build && rm -rf ./.next/cache",
"start": "next start",
"lint": "next lint"
},

"dependencies": {
"@nextui-org/react": "^1.0.0-beta.11",
"formik": "^2.2.9",
"jsonwebtoken": "^8.5.1",
"next": "13.0.5",
"next-auth": "^4.17.0",
"react": "18.2.0",
"react-date-range": "^1.0.0-beta",
"react-dom": "18.2.0",
"react-hook-form": "^7.40.0",
"react-icons": "^4.6.0",
"react-toastify": "^9.1.1",
"react-top-loading-bar": "^2.3.1"
},
"devDependencies": {
"any-text": "^1.2.0",
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}

@claustra01
Copy link

Hi, I solved same issue. Please try to change yml file in .github/workflows

Before:

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_BEACH_0A9C51000 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

After:

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_BEACH_0A9C51000 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "" # Built app content directory - optional
          app_build_command: 'npm run build'
          api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'
          ###### End of Repository/Build Configurations ######

@infospry
Copy link

hi @claustra01 thanks for the solution. It works perfectly now.

@IanIsFluent
Copy link

Hi, I solved same issue. Please try to change yml file in .github/workflows

Before:

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_BEACH_0A9C51000 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

After:

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_BEACH_0A9C51000 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "" # Built app content directory - optional
          app_build_command: 'npm run build'
          api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'
          ###### End of Repository/Build Configurations ######

Thanks for this! I can deploy now! BUT I can't take advantage of the build cache :(

I'm in Azure pipelines - I tried moving the cache folder to $(Pipeline.Workspace)/nextcache/ - but when I try to move it back I get mv: cannot stat '/home/vsts/work/1/nextcache/': No such file or directory 😢

@suriventures
Copy link

We have the same issue.
image

We are using Gitlab instead of Github, so we cannot use all of the guides for next.js and azure static web apps, since they are for Github.

Here is an example of the gitlab-ci.yml

image: node:14.16.0

variables:
  API_TOKEN: $DEPLOYMENT_TOKEN
  APP_PATH: "$CI_PROJECT_DIR"
  OUTPUT_PATH: "$CI_PROJECT_DIR/.next"

cache:
  paths:
    - node_modules/
    - .next/cache/

deploy:
  stage: deploy
  image: registry.gitlab.com/static-web-apps/azure-static-web-apps-deploy
  script:
    - echo "App deployed successfully."
  only:
    - main

This is our package.json


{
  "name": "xtrafit-spa",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build && rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/cache": "^11.10.5",
    "@emotion/react": "^11.10.5",
    "@emotion/server": "^11.10.0",
    "@emotion/styled": "^11.10.5",
    "@mui/material": "^5.11.2",
    "@next/font": "13.1.1",
    "@sentry/nextjs": "^7.37.0",
    "eslint": "8.30.0",
    "eslint-config-next": "13.1.1",
    "next": "13.1.1",
    "pino": "^8.10.0",
    "pino-logflare": "^0.3.12",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "swr": "^2.0.3"
  }
}

Normally we use Vercel for Next.js, but now we have to use Azure since it is a requirement from the client. Does anyone know how to fix this?

@infospry
Copy link

Hi, just add these lines in the yml
app_build_command: 'npm run build'
api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'

and problem will be fixed.

@suriventures
Copy link

Aren’t these variables for GitHub? As I mentioned before we are using Gitlab. Where exactly should I add them?

@sulabh-msft
Copy link

variables:
  APP_BUILD_COMMAND:  'npm run build'
  API_BUILD_COMMAND:  'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'
  /// <other variables>

deploy:
  stage: deploy
  image : registry.gitlab.com/static-web-apps/azure-static-web-apps-deploy
  script:
    - echo "App deployed successfully."

Refer to the https://gitlab.com/static-web-apps/azure-static-web-apps-deploy for more details on the parameters supported which can be passed as variables in .gitlab-ci.yml

@suriventures
Copy link

Hey,

thanks for the quick reply!

I added the variables you mentioned and now the pipeline doesn't break but it seems like the app doesn't build anymore and nothing is being deployed to azure.

image

image

image

image

Here is my updated gitlab-ci.yml

image: node:14.16.0

variables:
  APP_BUILD_COMMAND: "npm run build"
  API_BUILD_COMMAND: "rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache"
  API_TOKEN: $DEPLOYMENT_TOKEN
  APP_PATH: "$CI_PROJECT_DIR"
  OUTPUT_PATH: "$CI_PROJECT_DIR/.next"

cache:
  paths:
    - node_modules/
    - .next/cache/

deploy:
  stage: deploy
  image: registry.gitlab.com/static-web-apps/azure-static-web-apps-deploy
  script:
    - echo "App deployed successfully."
  only:
    - main

Do you have any idea what i did wrong?

@sulabh-msft
Copy link

@suriventures Thanks! for sharing the log. Looks like just adding single quotes is not helping us here.

Can we try adding double quotes also in the varible values as below ?

variables:
  APP_BUILD_COMMAND:  '"npm run build"'
  API_BUILD_COMMAND:  '"rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache"'
  /// <other variables>

deploy:
  stage: deploy
  image : registry.gitlab.com/static-web-apps/azure-static-web-apps-deploy
  script:
    - echo "App deployed successfully."
  

@thiagoalves
Copy link

Hi, I solved same issue. Please try to change yml file in .github/workflows

Before:

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_BEACH_0A9C51000 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

After:

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GREEN_BEACH_0A9C51000 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: "" # Built app content directory - optional
          app_build_command: 'npm run build'
          api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'
          ###### End of Repository/Build Configurations ######

Worked for me!! Thanks <3

@saud00
Copy link

saud00 commented Mar 20, 2023

i added above configurations in yml file but still getting error!

yml file:
Screenshot 2023-03-20 at 11 05 17 PM

Pakage.json file:
Screenshot 2023-03-20 at 10 59 57 PM

Error:
Screenshot 2023-03-20 at 11 03 35 PM

i also tried to put output : "standalone" in the next.config.js file but still getting same error

@IanIsFluent
Copy link

I mean, that's a lot of dependencies. Are you sure you aren't just over the size limit? 105MB isn't that much.

@saud00
Copy link

saud00 commented Mar 22, 2023

I mean, that's a lot of dependencies. Are you sure you aren't just over the size limit? 105MB isn't that much.

Yh, i am unable to uninstall these required dependencies, i think i am on wrong track to deploy this sized app on AZURE service. I think VERCEL deployment is right choice for this.

@IanIsFluent
Copy link

I mean, that's a lot of dependencies. Are you sure you aren't just over the size limit? 105MB isn't that much.

Yh, i am unable to uninstall these required dependencies, i think i am on wrong track to deploy this sized app on AZURE service. I think VERCEL deployment is right choice for this.

I believe the size limit will be increased once they are out of preview? But otherwise, it sounds like a plan 😅

@jptrepo
Copy link

jptrepo commented Mar 26, 2023

hi @claustra01 thanks for the solution. It works perfectly now.

Mine works too. Why does it work and why is it necessary? What are the drawbacks of this workaround?

@claustra01
Copy link

Mine works too. Why does it work and why is it necessary? What are the drawbacks of this workaround?

Azure Static Web App has an app size limit of about 100MB. In many error cases, the build cache causes the size to exceed this limit, which can be resolved by deleting the cache.

@Matt-CBI
Copy link

Matt-CBI commented Mar 30, 2023

I'm getting the same error using the Azure DevOps Pipeline not Github. We have very few packages so its frustrating that we are already hitting the limit!

Here is my package.json

{
  "private": true,
  "scripts": {
    "dev": "next",
    "dev-https": "next-dev-https --https --port 4430",
    "build": "next build && rm -rf ./.next/cache",
    "start": "next start",
    "lint": "next lint",
    "prepare": "husky install"
  },
  "dependencies": {
    "@auth0/nextjs-auth0": "^1.9.1",
    "ag-grid-react": "^29.2.0",
    "classnames": "^2.3.2",
    "mssql": "^9.1.1",
    "next": "latest",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-modal": "^3.16.1"
  },
  "devDependencies": {
    "@types/facebook-js-sdk": "^3.3.6",
    "@types/mssql": "^8.1.2",
    "@types/node": "^18.0.0",
    "@types/react": "^18.0.14",
    "@types/react-dom": "^18.0.5",
    "@types/react-modal": "^3.13.1",
    "eslint": "^8.36.0",
    "eslint-config-next": "13.2.4",
    "eslint-config-prettier": "^8.7.0",
    "husky": "^8.0.3",
    "lint-staged": "^13.2.0",
    "next-dev-https": "^0.1.1",
    "prettier": "2.8.5",
    "sass": "^1.60.0",
    "typescript": "^4.7.4"
  },
  "lint-staged": {
    "*.js": "eslint --cache --fix",
    "*.{js,css,md}": "prettier --write"
  }
}

And the YML file that Azure recommends:

name: Azure Static Web Apps CI/CD

pr:
  branches:
    include:
      - main
trigger:
  branches:
    include:
      - main

jobs:
  - job: build_and_deploy_job
    displayName: Build and Deploy Job
    condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
    pool:
      vmImage: ubuntu-latest
    variables:
      - group: Azure-Static-Web-Apps-xxxxxxxxxxxxxxx-group
    steps:
      - checkout: self
        submodules: true
      - task: AzureStaticWebApp@0
        inputs:
          azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN_XXXXXXXXXXXXXX)
          # Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: '/' # App source code path
          api_location: '' # Api source code path - optional
          output_location: '' # Built app content directory - optional
# End of Repository/Build Configurations #

You can see I have updated the build command to delete the nextjs cache folder but I am still hitting the same error.
Advice on this would be appreciated. Again we don't use GitHub or GitLab so variables for those pipelines won't work for me.

@enterpriseSoftware
Copy link

I tried all the workarounds, I still hit the limit. So Azure Static Web Apps can't cut it?

@IanIsFluent
Copy link

It's still in preview and they have mentioned increasing the limit AFAK.

paddyfed added a commit to paddyfed/TalesOfTheBountyHunters that referenced this issue May 8, 2023
@abhijit-me
Copy link

abhijit-me commented Jun 15, 2023

I created the default Next.JS app using the following command and the below settings.

npx create-next-app@latest ./

Typescript - Y
ESLint - N
Tailwind - Y
Src - N
App - Y

Next version is 13.4.5 and React version is 18.2.0

I created a Static Web App with the default settings for Next.JS.

I have the following lines in the yml file.

      app_location: "/" # App source code path
      api_location: "" # Api source code path - optional
      output_location: "" # Built app content directory - optional
      app_build_command: 'npm run build'
      api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'

App runs fine locally and shows the default Next.JS page but I always get a blank page when I browse to the static web app. What am I missing?

@Matt-CBI
Copy link

Matt-CBI commented Jun 16, 2023

You can configure the nextjs build to be standalone in the next.config.js file at root, like so:

module.exports = async (phase, { defaultConfig }) => {
  /**
   * @type {import('next').NextConfig}
   */
  const nextConfig = {
    output: 'standalone',
  };

  return nextConfig;
};

This reduces the build size so you shouldn't hit this issue again. Until Azure up the size limit.

mxmlnwbr added a commit to uzh-bf/thesis-platform that referenced this issue Sep 19, 2023
@JoelMTaylor
Copy link

JoelMTaylor commented Feb 5, 2024

Hi, just add these lines in the yml app_build_command: 'npm run build' api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'

and problem will be fixed.

This is still a problem for me. I have tried the suggested workarounds, but doesn't work.

I don't think I have a cache anyway. github.com/[repo]/actions/caches is empty.

Also, isn't the limit supposed to be 250 MB? Source

I am building an app using Retype.

@sulabh-msft, do you have any ideas? Or, @infospry?

@buttererror
Copy link

I have found another fix on stackoverflow to reduce the output size.
I enabled this feature in my next.config.js and it works now. Checkout this link

@faxg
Copy link

faxg commented Jun 2, 2024

fwis I have this error without Next.js - just a using pnpminstead of npm to build both the static web app and the /api. WeIf this 100MB is a hard limit, we should at least get some docs how to remove build caches for common tech stacks?

@so0601pk
Copy link

@buttererror @Matt-CBI
Hi! I use Azure Static web apps.
I resolved the pipelines error the help of the link you shared.
Thanks!

@sheikhmubashi
Copy link

Deployment Issue: Function Content Size Error on Azure Static Web App

Hi everyone,

I’m currently facing a deployment issue with my Azure Static Web App. The application was working perfectly fine until I added one more page. Now, I’m encountering the following error during deployment:

---End of Oryx build logs--- Web App Runtime Information. OS: linux, node version: 20 Finished building function app with Oryx Zipping Api Artifacts Done Zipping Api Artifacts The content server has rejected the request with: BadRequest Reason: The size of the function content was too large. The limit for this Static Web App is 262144000 bytes.

Here are the details of what I’ve tried so far:

Verified that the maximum size limit on Azure is set to 500MB, so it shouldn’t be a size issue.
Reviewed other suggestions mentioned in similar threads (e.g., reducing dependencies, optimizing the build), but none of them worked.
I’m attaching the following files for context:

  • package.json
  • next.config.js
  • GitHub Action Workflow File

The issue has broken my production environment, and I’d really appreciate it if someone could help me resolve this.

Thank you in advance!

package.json:

{
  "name": "rewriterpro_nextjs",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emailjs/browser": "^3.11.0",
    "@headlessui/react": "^0.0.0-insiders.043edb8",
    "@heroicons/react": "^2.0.18",
    "@next/third-parties": "^14.1.3",
    "@react-oauth/google": "^0.12.1",
    "@tailwindcss/aspect-ratio": "^0.4.2",
    "@tailwindcss/forms": "^0.5.3",
    "@tailwindcss/typography": "^0.5.9",
    "@types/jest": "^27.5.2",
    "@typescript-eslint/eslint-plugin": "^7.1.1",
    "@typescript-eslint/parser": "^7.1.1",
    "axios": "^1.6.7",
    "chatgpt": "^5.2.5",
    "crypto-browserify": "^3.12.0",
    "firebase": "^10.6.0",
    "next": "^14.1.1",
    "nextjs-toploader": "^1.6.12",
    "nprogress": "^0.2.0",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-firebase-hooks": "^5.1.1",
    "react-google-button": "^0.7.2",
    "react-minimal-pie-chart": "^8.4.0",
    "react-social-login-buttons": "^3.9.1",
    "rewriterpro_nextjs": "file:",
    "stream-browserify": "^3.0.0",
    "stripe": "^12.10.0",
    "txtgen": "^3.0.6",
    "web-vitals": "^2.1.4"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "eslint": "^8.57.0",
    "eslint-config-next": "14.1.1",
    "eslint-config-prettier": "^9.1.0",
    "postcss": "^8",
    "tailwindcss": "^3.3.0",
    "typescript": "^5"
  }
}

next config

/** @type {import('next').NextConfig} */
const nextConfig = {
};

export default nextConfig;
name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - master
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - master

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
          lfs: false
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_BUSH_0AF2C3D10 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "" # Api source code path - optional
          output_location: ".next" # Built app content directory - optional
          app_build_command: 'yarn run build'
          api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache'
        env:  # Put a node version on the following line
          NODE_VERSION: 20
          NEXT_PUBLIC_GOOGLE_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_CLIENT_ID }}
          NEXT_PUBLIC_GOOGLE_CLIENT_SECRET: ${{ secrets.NEXT_PUBLIC_GOOGLE_CLIENT_SECRET}}
          NEXT_PUBLIC_OPEN_AI_API_KEY: ${{ secrets.NEXT_PUBLIC_OPEN_AI_API_KEY}}
          NEXT_PUBLIC_WEBSITE_HTTPLOGGING_RETENTION_DAYS: ${{ secrets.NEXT_PUBLIC_WEBSITE_HTTPLOGGING_RETENTION_DAYS}}
          NEXT_PUBLIC_PRODUCT_ID: ${{ secrets.NEXT_PUBLIC_PRODUCT_ID}}
          NEXT_PUBLIC_ENV: ${{ secrets.NEXT_PUBLIC_ENV}}
          NEXT_PUBLIC_ATLAS_DATA_API_KEY: ${{ secrets.NEXT_PUBLIC_ATLAS_DATA_API_KEY }}
          NEXT_PUBLIC_EMAILJS_SERVICE_ID: ${{ secrets.NEXT_PUBLIC_EMAILJS_SERVICE_ID }}
          NEXT_PUBLIC_EMAILJS_TEMPLATE_ID: ${{ secrets.NEXT_PUBLIC_EMAILJS_TEMPLATE_ID }}
          NEXT_PUBLIC_EMAILJS_TEMPLATE_ID_CONTACT_FORM: ${{ secrets.NEXT_PUBLIC_EMAILJS_TEMPLATE_ID_CONTACT_FORM }}
          NEXT_PUBLIC_EMAILJS_PUBLIC_KEY: ${{ secrets.NEXT_PUBLIC_EMAILJS_PUBLIC_KEY }}
          NEXT_PUBLIC_STRIPE_SECRET_KEY_PROD: ${{ secrets.NEXT_PUBLIC_STRIPE_SECRET_KEY_PROD }}
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v1
        with:
          app_location: "/"
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_BUSH_0AF2C3D10 }}
          action: "close"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests