Having trouble deploying a site

2:05:26 PM: Deploy site
2:05:26 PM: ────────────────────────────────────────────────────────────────
2:05:26 PM: ​
2:05:26 PM: Starting to deploy site from ‘.next’
2:05:26 PM: Calculating files to upload
2:05:27 PM: 0 new file(s) to upload
2:05:27 PM: 1 new function(s) to upload
2:05:29 PM: Failed to create function: invalid parameter for function creation: Unzipped size must be smaller than 262144000 bytes
2:05:30 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
2:05:30 PM: Failed to upload file: ___netlify-server-handler
2:05:30 PM: Section completed: deploying
2:05:30 PM: ​
2:05:30 PM: Error deploying
2:05:30 PM: ────────────────────────────────────────────────────────────────
2:05:30 PM: ​
2:05:30 PM: Error message
2:05:30 PM: Deploy did not succeed with HTTP Error 400: [PUT /deploys/{deploy_id}/functions/{name}][400] uploadDeployFunction default &{Code:400 Message:Failed to create function: invalid parameter for function creation: Unzipped size must be smaller than 262144000 bytes}
2:05:30 PM: ​
2:05:30 PM: Error location
2:05:30 PM: At deploy the stage with HTTP status code ‘400’
2:05:30 PM: ​
2:05:30 PM: Resolved config
2:05:30 PM: build:
2:05:30 PM: command: npm run build
2:05:30 PM: commandOrigin: ui
2:05:30 PM: publish: /opt/build/repo/.next
2:05:30 PM: publishOrigin: ui
2:05:30 PM: plugins:
2:05:30 PM: - inputs: {}
2:05:30 PM: origin: ui
2:05:30 PM: package: ‘@netlify/plugin-nextjs’
2:05:30 PM: redirects:
2:05:30 PM: - from: /_next/image
2:05:30 PM: query:
2:05:30 PM: q: ‘:quality’
2:05:30 PM: url: ‘:url’
2:05:30 PM: w: ‘:width’
2:05:30 PM: status: 200
2:05:30 PM: to: /.netlify/images?url=:url&w=:width&q=:quality
2:05:30 PM: - from: /_ipx/*
query:
q: ‘:quality’
url: ‘:url’
w: ‘:width’
status: 200
to: /.netlify/images?url=:url&w=:width&q=:quality
redirectsOrigin: inline
2:05:30 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:05:30 PM: Failing build: Failed to build site

@Akash_M The error is:

2:05:29 PM:
  Failed to create function:
  invalid parameter for function creation:
  Unzipped size must be smaller than 262144000 bytes

It indicates you have a very large function which is exceeding the limit.

It’s apparently an AWS limit which cannot be increased, as per this discussion:
https://answers.netlify.com/t/deployment-fails-unzipped-size-must-be-smaller-than-262144000-bytes/80765

1 Like