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

UUID attribute type failing validation check on Create and Update. #8294

Closed
chaitanyya opened this issue Oct 12, 2020 · 3 comments · Fixed by #8297
Closed

UUID attribute type failing validation check on Create and Update. #8294

chaitanyya opened this issue Oct 12, 2020 · 3 comments · Fixed by #8297

Comments

@chaitanyya
Copy link
Contributor

Describe the bug
After migrating to Strapi v3.2.x all our models that have attribute "type": "uuid" fail for Create and Update requests. Once I removed the attribute definitions from the model settings all Create and Update requests work as expected. I believe it's because of the failing validation check.

Steps to reproduce the behavior

  1. Define a model with an attribute with "type": "uuid"
  2. Try to create or update an entry from this model.
  3. The request fails with HTTP 500
  4. You see Error: invalid.input in the logs.

Expected behavior
The request should not fail and the entry should be created in the database. I'm using Postgres default UUID generator to handle the generation part so no check or support is required on the Strapi side as long as Strapi allows this type to exist in the model. Basically return whatever is in the database.

Code snippets

Model Definition:

{
  "kind": "collectionType",
  "collectionName": "tests",
  "info": {
    "name": "Test"
  },
  "options": {
    "increments": true,
    "timestamps": true
  },
  "attributes": {
    "uField": {
      "type": "uuid",
      "configurable": false
    },
    "Name": {
      "type": "string"
    },
    "Type": {
      "type": "string"
    }
  }
}

Error Logged:

[2020-10-12T10:17:09.055Z] error Error: invalid.input
  at formatYupErrors (/srv/app/node_modules/strapi-utils/lib/validators.js:45:11)
  at Object.validateEntityUpdate (/srv/app/node_modules/strapi/lib/services/entity-validator/index.js:177:65)
  at Object.update (/srv/app/node_modules/strapi-plugin-content-manager/controllers/ContentManager.js:316:34)
  at async /srv/app/node_modules/strapi/lib/middlewares/router/utils/routerChecker.js:79:22
  at async module.exports (/srv/app/node_modules/strapi-plugin-content-manager/config/policies/routing.js:52:3)
  at async /srv/app/node_modules/strapi-utils/lib/policy.js:68:5
  at async /srv/app/node_modules/strapi/lib/middlewares/parser/index.js:48:23
  at async /srv/app/node_modules/strapi/lib/middlewares/xss/index.js:26:9
[2020-10-12T10:17:09.055Z] debug PUT /content-manager/explorer/application::test.test/2 (57 ms) 500

System

  • Node.js version: 12.18.2
  • Yarn version: 1.22.4
  • Strapi version: 3.2.3
  • Database: Postgres
  • Operating system: MacOS
@sam899
Copy link
Contributor

sam899 commented Oct 12, 2020

I'm seeing the same error, but I dont have a UUID field in my models. Still trying to track down which attribute is causing the issue.

@chaitanyya
Copy link
Contributor Author

Interesting, for me it only happens when there is an UUID attribute. Maybe you found another attribute that might cause the issue. For now I've removed all UUID fields.

@sam899
Copy link
Contributor

sam899 commented Oct 12, 2020

Looks like for me, I have some custom fields that seems to be the cause of the issue.

I created the field types as per:
https://strapi.io/documentation/v3.x/plugin-development/frontend-field-api.html#registering-a-new-field

I can't remove these fields, so I'll have to rollback a version until this is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants