Next.js Discord

Discord Forum

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

Unanswered
hojomojo posted this in #help-forum
Open in Discord
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.

4 Replies

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;
Github action

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 }} action: "upload" app_location: "/" api_location: "" output_location: ".next" app_build_command: 'yarn run build' api_build_command: 'rm -rf ./node_modules/@next/swc-* && rm -rf ./.next/cache' env:
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 }} 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"