Skip to content
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

422 "No records matched" error when deploying #6403

Open
ali-kamalizade opened this issue Feb 22, 2024 · 6 comments
Open

422 "No records matched" error when deploying #6403

ali-kamalizade opened this issue Feb 22, 2024 · 6 comments
Labels
type: bug code to address defects in shipped code

Comments

@ali-kamalizade
Copy link

ali-kamalizade commented Feb 22, 2024

Describe the bug

I am adding multi-language support to one of our web apps. We use GitHub actions to deploy new versions. This has worked so far but since changing the structure of our app the deployment appears to fail rather often. The error logs mention a 422 unprocessable entity error.

The file structure in the file browser looks like this:

  • en (contains index.html and other files)
  • de (contains index.html and other files)
  • netlify.toml

But the deployment itself seems (?) to have worked as the changes seem to be available in production hence it might be something after the deployment that the Netlify CLI is attempting to do which causes our GitHub workflow to fail.

Error logs
✔ Finished uploading blobs to deploy store
- Hashing files...
- Looking for a functions cache...
✔ Deploying functions from cache (use --skip-functions-cache to override)
✔ Finished hashing 741 files and 4 functions
- CDN diffing files...
✔ CDN requesting 8 files and 0 functions
- Uploading 10 files
 ›   Warning: JSONHTTPError: No records matched 422
 ›   Warning: 
{
  "name": "JSONHTTPError",
  "status": 422,
  "json": {
    "code": 422,
    "message": "No records matched"
  }
}
​
Save updated config                                           
────────────────────────────────────────────────────────────────
​
(options.onEnd completed in 172ms)
​
Internal error during "options.onPostBuild"                   
────────────────────────────────────────────────────────────────
​
  Error message
  JSONHTTPError: Unprocessable Entity
​
  Error location
  During options.onPostBuild
      at parseResponse (file:///home/runner/work/web-app/web-app/node_modules/netlify-cli/node_modules/netlify/lib/methods/response.js:10:39)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async callMethod (file:///home/runner/work/web-app/web-app/node_modules/netlify-cli/node_modules/netlify/lib/methods/index.js:26:28)
      at async tryUpload (file:///home/runner/work/web-app/web-app/node_modules/netlify-cli/dist/utils/deploy/upload-files.js:80:29)

{
    name: 'JSONHTTPError',
    status: 422,
    json: { code: 422, message: 'No records matched' }
 }

Steps to reproduce

It is hard to reproduce reliably but here is my best guess:

  1. Change a lot of files
  2. Run the deployment command: npx netlify deploy --prod --build --filter apps/web-app

Configuration

[build]
  publish = "dist/web-app"
  command = "npm run build:main-app"
  functions = "./functions"
  environment = { NODE_ENV = "development", NODE_VERSION = "20.6.1" }
[[plugins]]
  package = "@netlify/plugin-functions-install-core"

# Since this is a single page application, we need to redirect all requests to the index.html file
[[redirects]]
  from = "/en/*"
  to = "/en/index.html"
  status = 200

[[redirects]]
  from = "/de/*"
  to = "/de/index.html"
  status = 200

# fallback for URLs without language prefix
[[redirects]]
  from = "/*"
  to = "/en/index.html"
  status = 200

Environment

I am using netlify-cli@17.16.3.

System:
    OS: macOS 14.3.1
    Memory: 1.50 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
Binaries:
    Node: 20.6.1 - ~/.nvm/versions/node/v20.6.1/bin/node
    npm: 9.8.1 - ~/.nvm/versions/node/v20.6.1/bin/npm
@ali-kamalizade ali-kamalizade added the type: bug code to address defects in shipped code label Feb 22, 2024
@ali-kamalizade ali-kamalizade changed the title 422 No records matched when deploying 422 "No records matched" error when deploying Feb 22, 2024
@kitop
Copy link
Member

kitop commented Apr 18, 2024

Hi @ali-kamalizade do you have a reproduction case you can share with files and everything? We're investigating and having something reproducible would help a ton. Thanks!

@ali-kamalizade
Copy link
Author

Hi @ali-kamalizade do you have a reproduction case you can share with files and everything? We're investigating and having something reproducible would help a ton. Thanks!

Hi @kitop , thank you for your reply!

Unfortunately, I can't share any reproduction. What I do think is it may simply be related to the size. In our case, the folders (en, de - see the file structure above) have basically the same size. Right now it's ~28MB per folder. Hence, before we did the localization we only had to deploy 28MB while the size needed to be uploaded to Netlify has now been doubled (2 * 28MB = 56MB). I also have to state that it does not fail all the time (the worst kind of bugs: e.g. it failed 1/4 times today).

@kitop
Copy link
Member

kitop commented Apr 18, 2024

Gotcha.
Are the files in the en and de directories all different? do you share some? I'm curious as well if there are symlinks or if the build process is modifying these files somehow.
Anything you can share about the structure and the build process would be super helpful to continue debugging. Thanks!

@ali-kamalizade
Copy link
Author

Gotcha. Are the files in the en and de directories all different? do you share some? I'm curious as well if there are symlinks or if the build process is modifying these files somehow. Anything you can share about the structure and the build process would be super helpful to continue debugging. Thanks!

The files are basically the same: when doing a production build, the builder goes through the HTML and TypeScript files to replace any marked texts with the ones in the respective translation files (XLF). We are using the i18n capabilities of Angular. Hence the project structure looks like a typical Angular project, containing index.html, JS bundles, scripts (e.g. analytics) and assets (e.g. app logo). Hope this helps!

@kitop
Copy link
Member

kitop commented Apr 19, 2024

Thanks!
One last question: do you have any plugins or integrations in your build process? I'm mostly curious of anything that can run onBuild or similar.

@ali-kamalizade
Copy link
Author

Thanks! One last question: do you have any plugins or integrations in your build process? I'm mostly curious of anything that can run onBuild or similar.

Not that I'm aware of, it's a pretty simple setup and we don't use any Netlify build plugins. It's basically running the production build and then deploying it right away with the Netlify CLI as part of our GitHub workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants