Build script returned non-zero exit code. Deploy did not succeed with HTTP Error 400

After a 4 month hiatus from this project I have attempted to make some deploys today and they all failed in the same way. I apologize in advance I have never encountered deploy failures on this project before, and after consulting the forums and AI chatbot, I am still unsure how to proceed.

Site domain: sitescout.pro
Netlify site name: site-scout.netlify.app
Remix app

3:45:30 PM: Deploy site                                                   
3:45:30 PM: ────────────────────────────────────────────────────────────────
3:45:30 PM: ​
3:45:30 PM: Starting to deploy site from 'public'
3:45:31 PM: Calculating files to upload
3:45:31 PM: 0 new files to upload
3:45:31 PM: 1 new functions to upload
3:45:42 PM: Failed to create function on AWS Lambda: invalid parameter for lambda creation: Invalid AWS Lambda parameters used in this request.
3:45:42 PM: Failed to upload file: server
3:45:42 PM: Section completed: deploying
3:45:42 PM: ​
3:45:42 PM: Error deploying                                               
3:45:42 PM: ────────────────────────────────────────────────────────────────
3:45:42 PM: ​
3:45:42 PM:   Error message
3:45:42 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 on AWS Lambda: invalid parameter for lambda creation: Invalid AWS Lambda parameters used in this request.}
3:45:42 PM: ​
3:45:42 PM:   Error location
3:45:42 PM:   At deploy the stage with HTTP status code '400'
3:45:42 PM: ​
3:45:42 PM:   Resolved config
3:45:42 PM:   build:
3:45:42 PM:     command: remix build
3:45:42 PM:     commandOrigin: config
3:45:42 PM:     environment:
3:45:42 PM:       - FB_CLIENT_EMAIL
3:45:42 PM:       - FB_CLIENT_ID
3:45:42 PM:       - FB_CLIENT_X509_CERT_URL
3:45:42 PM:       - FB_PRIVATE_KEY
3:45:42 PM:       - FB_PRIVATE_KEY_ID
3:45:42 PM:       - FB_PROJECT_ID
3:45:42 PM:       - GPT_API_KEY
3:45:42 PM:       - SESSION_SECRET
3:45:42 PM:       - STRIPE_SECRET_KEY
3:45:42 PM:       - STRIPE_WEBHOOK_SECRET
3:45:42 PM:     publish: /opt/build/repo/public
3:45:42 PM:     publishOrigin: config
3:45:42 PM:   functionsDirectory: /opt/build/repo/netlify/functions
3:45:42 PM:   headers:
3:45:43 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:45:43 PM:     - for: /build/*
      values:
        Cache-Control: public, max-age=31536000, immutable
  headersOrigin: config
  redirects:
    - from: /*
      status: 200
      to: /.netlify/functions/server
  redirectsOrigin: config
3:45:43 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:45:43 PM: Failing build: Failed to build site```

Hey there, looking at your build, it seems that this is the reason for failure.

We’ll need more info about what parameters you’re trying to use within your function, but I’m seeing there are a ton of results on google for build errors with “invalid parameter for lambda creation: Invalid AWS Lambda parameters used in this request.” You might find your solution there or you can give us more details about what parameters you’re trying to set that may be invalid!

Thanks!

Thank you for the replay. I have tried searching for answers with your suggested query and will continue to, but I fear I am out of my depth here.

The Remix application with the Netlify preset has a server.ts file conatining…

import * as build from "@remix-run/dev/server-build";
import { createRequestHandler } from "@remix-run/netlify";
import { installGlobals } from "@remix-run/node";

installGlobals();

export const handler = createRequestHandler({
  build,
  mode: process.env.NODE_ENV,
});

As for the function parameters, I am unsure how to find that information. I have never touched anything within the /netlify/functions folder and I believe Remix handles that. Continuous deploys have worked with this project for months. However, these recent error deploys are the first deploys to this project after a 5 month break from working on it.

I appreciate any help or advice. In the mean time I will continue searching for answers on Google.

:wave: In this case, this is due to a recent change we rolled out. I’m going to exclude you from the rollout for now while we investigate a solution to this.

1 Like

Thank you so much! That is a relief. I will attempt to redeploy my changes in a few hours.

Deploy was successful. Thank you.

Hi, I am sorry for writing here and “hijacking” the theme, but I think it’s better than opening another one.

In short: we have the very same problem. Our Site name ist “wmq-stage”. Could you please take the project out of the rollout of the new changes as well. Hoping for a fast response.

EDIT: The urgent problem got fixed, so it’s not as urgent now, but we would like to have this resolved, so we can deploy updates in the future.

@nikolay I’ve excluded the site wmq-stage - can you redeploy and let me know if you’re successful?

@sid.m Thank you for the fast response. Unfortunately the deploy still fails.

@nikolay, you mentioned the problem got fixed. Could you clarify what do you mean by deploy still fails then?

The problem, because of which we needed to deploy a fix, was resolved. If you check the edit history of my comment, you will see what that is about.

We still cannot deploy.

We are seeing the same issue: 4:12:51 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 on AWS Lambda: invalid parameter for lambda creation: Invalid AWS Lambda parameters used in this request.}

hey Aaron, thanks for reaching out, and I’m really sorry for the hassle here! Nextjs sites are currently dependent on the above changes so they unfortunately can’t be manually rolled back in a similar fashion, although we can definitely work with you to get past these errors. Can you link us to a deploy where you’re seeing these issues?

hey Nikolay, thanks for following up and apologies as well for the back and forth here, I’ve made a slight adjustment to the backend flag on our end, can you let me know if subsequent deploys are successful?

Thanks Marcus, is it typical to post deployment ids in these public forums? I’d prefer to share securely. The one giving this latest error is the latest 2 deploys we have done.

Hi Marcus, it works now. Thanks!

Can you do the same thing that you did for nikolay?

Hey Marcus, is there an official support email you can share? We are facing the same problem with some of our netlify’s sites, so we dont have to post them here.

Netlify updated the feature flag for us and we are unblocked for now.

@castillo It looks like your colleague opened a ticket about this in our helpdesk, feel free to follow up there!