Nextjs App failed to deploy after a successfull build

Site with the ID 4f96150a-0977-46fe-9466-85cf29d1a30a has failed to deploy.

The app builds successfully and then fails to deploy due to the error below. I have researched and could not fix the issue. The error I am encountering is Deploy did not succeed with HTTP Error 400

This is the error log:

11:45:01 AM: Deploy site

11:45:01 AM: ────────────────────────────────────────────────────────────────

11:45:01 AM: ​

11:45:01 AM: Starting to deploy site from ‘.next’

11:45:01 AM: Calculating files to upload

11:45:01 AM: 3 new file(s) to upload

11:45:01 AM: 1 new function(s) to upload

11:45:07 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2

11:45:06 AM: Failed to create function: invalid parameter for function creation: Invalid AWS Lambda parameters used in this request.

11:45:06 AM: Failed to upload file: ___netlify-server-handler

11:45:06 AM: Section completed: deploying

11:45:06 AM: ​

11:45:06 AM: Error deploying

11:45:06 AM: ────────────────────────────────────────────────────────────────

11:45:06 AM: ​

11:45:06 AM: Error message

11:45:06 AM: 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: Invalid AWS Lambda parameters used in this request.}

11:45:06 AM: ​

11:45:06 AM: Error location

11:45:06 AM: At deploy the stage with HTTP status code ‘400’

11:45:06 AM: ​

11:45:06 AM: Resolved config

11:45:06 AM: build:

11:45:06 AM: command: bun run build

11:45:06 AM: commandOrigin: ui

11:45:06 AM: environment:

11:45:06 AM: - NEXT_PUBLIC_AIRTABLE_TABLE

11:45:06 AM: - NEXT_PUBLIC_AIRTABLE_TOKEN

11:45:06 AM: - NEXT_PUBLIC_APP_URL

11:45:06 AM: - NEXT_PUBLIC_BASE_URL

11:45:06 AM: - NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME

11:45:06 AM: - NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET

11:45:06 AM: - NEXT_PUBLIC_FLUTTERWAVE_APP_NAME

11:45:06 AM: - NEXT_PUBLIC_FLUTTERWAVE_PUBLIC_KEY

11:45:06 AM: - NEXT_PUBLIC_GA_GTM_ID

11:45:06 AM: - NEXT_PUBLIC_GA_MEASURE_ID

11:45:06 AM: - NEXT_PUBLIC_GOOGLE_CLIENT_ID

11:45:06 AM: - NEXT_PUBLIC_HIREFOSTER_EMPLOYER_URL

11:45:06 AM: publish: /opt/build/repo/.next

11:45:06 AM: publishOrigin: ui

11:45:06 AM: headers:

11:45:06 AM: - for: /_next/static/*
values:
Cache-Control: public, max-age=31536000, immutable
headersOrigin: inline
plugins:

  • inputs: {}
    origin: ui
    package: ‘@netlify/plugin-nextjs’
    redirects:
  • from: /_next/image
    query:
    q: ‘:quality’
    url: ‘:url’
    w: ‘:width’
    status: 200
    to: /.netlify/images?url=:url&w=:width&q=:quality
  • from: /_ipx/*
    query:
    q: ‘:quality’
    url: ‘:url’
    w: ‘:width’
    status: 200
    to: /.netlify/images?url=:url&w=:width&q=:quality
    redirectsOrigin: inline

11:45:06 AM: Build failed due to a user error: Build script returned non-zero exit code: 2

11:45:06 AM: Failing build: Failed to build site

Could you try again?

Deployment Successful.
Thank you