Can no longer deploy lambda functions "unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest"

Hello support team!

We’re unable to deploy our lamdba functions to our site. I know it last successfully worked on Feb 15, 2024. Since last week, when we started testing some updates, we’ve been getting the error “unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest” on the feature branch. To verify it wasn’t due to any of our changes, we tried a new deployment from our main branch with the same commit that worked successfully in February and it also failed with the same error.

I’ve gone through all of the support guides, the Build troubleshooting tips, searched the support forums and the internet, and I haven’t found the exact same error message. Other similar messages have seemed to not been related or had a fix that was unrelated to our code/stack. On another feature/test branch, I tried updating our package.json files to use netlify-cli instead of netlify-lambda, as well as adding all of our dependencies to the root package.json. I also added a .node-version file to the feature branch to match the Node version that I’m using on my laptop, with no change (but the log did indicate that it correctly identified and downloaded the correct version).

The only thing that seems to work is if we remove or rename our .json files (besides package.json and package-lock.json) located in our functions directories. We’d prefer not to do that, as that seems more like a messy workaround, at least without knowing or understanding why we can’t have .json files.

I did try the Ask Netlify AI, but it didn’t give me much guidance except that it might have something to do with a manifest.json file. We don’t have one unless we run netlify build, then one is generated in .netlify\functions\manifest.json. I’m not sure if netlify deploy (or any other deployment type) generates one and if it’s different.

Deploy URL: Netlify
Deploy ID: 670ed8d760fb346e93946b91

Context: Production: main@HEAD
Deployment Type: Netlify UI (but I’ve also been testing feature branch deployments through Netlify CLI so I don’t need to keep committing for an automatic deployment)
Last Broken Deploy URL: Netlify
Last Successful Deploy URL: Netlify

The build logs follow. These are from the main (Production) branch that was the same commit as the last successful deployment.

5:04:41 PM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
5:04:41 PM: buildbot version: c1ccefdee611eab5836a599df80d16b6e08180cb
5:04:41 PM: Fetching cached dependencies
5:04:41 PM: Failed to fetch cache, continuing with build
5:04:41 PM: Starting to prepare the repo for build
5:04:42 PM: No cached dependencies found. Cloning fresh repo
5:04:42 PM: git clone --filter=blob:none git@gitlab.com:te-curriculum/curriculum-utility-projects/te-curriculum-apis
5:04:43 PM: Preparing Git Reference refs/heads/main
5:04:47 PM: Starting to install dependencies
5:04:47 PM: Python version set to 3.8
5:04:47 PM: Attempting Ruby version 2.7.2, read from environment
5:04:48 PM: Using Ruby version 2.7.2
5:04:49 PM: Started restoring cached go cache
5:04:49 PM: Finished restoring cached go cache
5:04:49 PM: Installing Go version 1.17 (requested 1.17)
5:04:55 PM: go version go1.17 linux/amd64
5:04:56 PM: Using PHP version 8.0
5:04:58 PM: Downloading and installing node v20.18.0…
5:04:59 PM: Downloading https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-x64.tar.xz
5:04:59 PM: Computing checksum with sha256sum
5:04:59 PM: Checksums matched!
5:05:03 PM: Now using node v20.18.0 (npm v10.8.2)
5:05:03 PM: Enabling Node.js Corepack
5:05:03 PM: Started restoring cached build plugins
5:05:03 PM: Finished restoring cached build plugins
5:05:03 PM: Started restoring cached corepack dependencies
5:05:03 PM: Finished restoring cached corepack dependencies
5:05:03 PM: No npm workspaces detected
5:05:03 PM: Started restoring cached node modules
5:05:03 PM: Finished restoring cached node modules
5:05:03 PM: Installing npm packages using npm version 10.8.2
5:05:04 PM: added 12 packages, and audited 13 packages in 976ms
5:05:04 PM: 1 package is looking for funding
5:05:04 PM: run npm fund for details
5:05:04 PM: 1 high severity vulnerability
5:05:04 PM: To address all issues, run:
5:05:04 PM: npm audit fix --force
5:05:04 PM: Run npm audit for details.
5:05:04 PM: npm packages installed
5:05:05 PM: Successfully installed dependencies
5:05:05 PM: Starting build script
5:05:07 PM: Detected 0 framework(s)
5:05:07 PM: Section completed: initializing
5:05:09 PM: ​
5:05:09 PM: Netlify Build
5:05:09 PM: ────────────────────────────────────────────────────────────────
5:05:09 PM: ​
5:05:09 PM: ❯ Version
5:05:09 PM: @netlify/build 29.55.2
5:05:09 PM: ​
5:05:09 PM: ❯ Flags
5:05:09 PM: accountId: 5eee703d2e59e4b356d0006c
5:05:09 PM: baseRelDir: true
5:05:09 PM: buildId: 670ed8d760fb346e93946b8f
5:05:09 PM: deployId: 670ed8d760fb346e93946b91
5:05:09 PM: ​
5:05:09 PM: ❯ Current directory
5:05:09 PM: /opt/build/repo
5:05:09 PM: ​
5:05:09 PM: ❯ Config file
5:05:09 PM: /opt/build/repo/netlify.toml
5:05:09 PM: ​
5:05:09 PM: ❯ Context
5:05:09 PM: production
5:05:11 PM: Installing functions dependencies
5:05:28 PM: ​
5:05:28 PM: Functions bundling
5:05:28 PM: ────────────────────────────────────────────────────────────────
5:05:28 PM: ​
5:05:28 PM: Packaging Functions from api-functions directory:
5:05:28 PM: - books/books.js
5:05:28 PM: - celestial-objects/celestial-objects.js
5:05:28 PM: - facts/facts.js
5:05:28 PM: - movies/movies.js
5:05:28 PM: - national-park-exercise/national-park-exercise.js
5:05:28 PM: - pictures/pictures.js
5:05:28 PM: - statetax/statetax.js
5:05:28 PM: - weather/weather.js
5:05:28 PM: ​
5:05:31 PM: ​
5:05:31 PM: (Functions bundling completed in 3s)
5:05:31 PM: ​
5:05:31 PM: Deploy site
5:05:31 PM: ────────────────────────────────────────────────────────────────
5:05:31 PM: ​
5:05:32 PM: Starting to deploy site from ‘/’
5:05:34 PM: Calculating files to upload
5:05:45 PM: unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest
5:05:45 PM: unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest
5:05:45 PM: unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest
5:05:45 PM: unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest
5:05:45 PM: unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest
5:05:45 PM: 1 new file(s) to upload
5:05:45 PM: 6 new function(s) to upload
5:05:45 PM: Failed to upload file: pictures
5:05:45 PM: Failed to upload file: celestial-objects
5:05:45 PM: Failed to upload file: facts
5:05:45 PM: Failed to upload file: books
5:05:45 PM: Failed to upload file: movies
5:05:52 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)
5:05:52 PM: Section completed: deploying
5:05:52 PM: ​
5:05:52 PM: Error deploying
5:05:52 PM: ────────────────────────────────────────────────────────────────
5:05:52 PM: ​
5:05:52 PM: Error message
5:05:52 PM: Deploy did not succeed with HTTP Error 400: [PUT /deploys/{deploy_id}/functions/{name}][400] uploadDeployFunction default &{Code:400 Message:unable to decode manifest file: json: cannot unmarshal array into Go value of type handler.functionManifest}
5:05:52 PM: ​
5:05:52 PM: Error location
5:05:52 PM: At deploy the stage with HTTP status code ‘400’
5:05:52 PM: ​
5:05:52 PM: Resolved config
5:05:52 PM: build:
5:05:52 PM: publish: /opt/build/repo
5:05:52 PM: publishOrigin: config
5:05:52 PM: functionsDirectory: /opt/build/repo/api-functions
5:05:52 PM: headers:
5:05:52 PM: - for: /*
values:
Access-Control-Allow-Origin: '
headersOrigin: config
plugins:
- inputs: {}
origin: config
package: ‘@netlify/plugin-functions-install-core’
redirects:
- from: /api/cats/
/random
5:05:52 PM: status: 200
5:05:52 PM: to: /.netlify/functions/:splat
5:05:52 PM: - from: /books-api/books/*
status: 301
to: /api/books/:splat
- from: /books-api/authors/*
status: 301
to: /api/books/authors/:splat
- from: /books-api/genres/*
status: 301
to: /api/books/genres/:splat
- from: /movies-api/movies/*
status: 301
to: /api/movies/:splat
- from: /movies-api/genres/*
status: 301
to: /api/movies/genres/:splat
- from: /celestial-objects-api/celestial-objects/*
status: 301
to: /api/celestial-objects/:splat
- from: /celestial-objects-api/categories/*
status: 301
to: /api/celestial-objects/categories/:splat
- from: /api/national-park-exercise/verify/*
status: 308
to: /api/national-park-exercise/challenges/:splat/verify
- from: /api/*
status: 200
to: /.netlify/functions/:splat
redirectsOrigin: config
5:05:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:05:52 PM: Failing build: Failed to build site
5:05:52 PM: Finished processing build request in 1m11.436s

Do you mind sharing your repo so we can check?

Hi Hrishikesh, I can certainly do that but it’s a private repository hosted on GitLab that I can’t make public, but I can add users. Would you mind sharing your GitLab.com username with me and I can add you to our access list? Thanks!

Username is @hrishikeshk

Hi Hrishikesh, I added you to the project as a Guest with an expiration date of Nov 8. If we’re still troubleshooting this beyond that date, I’ll extend it. The repository is https://gitlab.com/te-curriculum/curriculum-utility-projects/te-curriculum-apis

While I agree I’m not a regular GitLab user and have never used its collaboration features, either I’m missing something here or there has been some error in giving me access. On your link, I don’t see any code. I tried to check the code tab, but all I see is “Snippets”

I updated your permission to “Reporter” access. Apparently “Guest” doesn’t work if the project isn’t public, which I didn’t know until now. We have other users outside of our organization with “Reporter” access, so I think that should work for you. I also updated the expiration date for your access to Nov 15.

Thank you, I took a look and this is strange indeed. While there are a couple things wrong with your setup, none of them should be responsible for the error you’re getting. I tried changing those things anyways, but still got the error.

I’ve asked the devs to take a look.

1 Like

This might be happening due to the JSON files having the same name as the Functions. Could you try renaming either of them?

1 Like

That did it! I know I tried that before and it did work, but wasn’t quite sure why. If it’s because the JSON files have the same name as the functions, and that’s no longer allowed (it did work before), it’s good enough for me. I merged those changes into our main branch and deployed it.