-
Notifications
You must be signed in to change notification settings - Fork 59
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
Comments
Hi @marnocha, Thanks for reaching out! As a workaround you can try below steps:
We are working on improving the experience. We'll let know about the future updates. Thanks! |
Thank you, the workaround works! |
Hi, |
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 |
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. |
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 "dependencies": { |
Hi, I solved same issue. Please try to change yml file in .github/workflows Before:
After:
|
hi @claustra01 thanks for the solution. It works perfectly now. |
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 |
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
This is our package.json
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? |
Hi, just add these lines in the yml and problem will be fixed. |
Aren’t these variables for GitHub? As I mentioned before we are using Gitlab. Where exactly should I add them? |
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 |
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. Here is my updated gitlab-ci.yml
Do you have any idea what i did wrong? |
@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."
|
Worked for me!! Thanks <3 |
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 😅 |
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. |
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
And the YML file that Azure recommends:
You can see I have updated the build command to delete the nextjs cache folder but I am still hitting the same error. |
I tried all the workarounds, I still hit the limit. So Azure Static Web Apps can't cut it? |
It's still in preview and they have mentioned increasing the limit AFAK. |
I created the default Next.JS app using the following command and the below settings. npx create-next-app@latest ./ Typescript - 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 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? |
You can configure the nextjs build to be standalone in the next.config.js file at root, like so:
This reduces the build size so you shouldn't hit this issue again. Until Azure up the size limit. |
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? |
I have found another fix on stackoverflow to reduce the output size. |
fwis I have this error without Next.js - just a using |
@buttererror @Matt-CBI |
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:
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.
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"
|
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!
The text was updated successfully, but these errors were encountered: