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

Migration v3.1.2 | Error : Schema hasn't been registered for model "user" #7252

Closed
devaublanc opened this issue Jul 29, 2020 · 6 comments · Fixed by #7275 · May be fixed by songshansitulv/strapi#185 or songshansitulv/strapi#186
Closed

Comments

@devaublanc
Copy link
Contributor

devaublanc commented Jul 29, 2020

Describe the bug
Since the migration that I did perfectly https://strapi.io/documentation/v3.x/migration-guide/migration-guide-3.0.x-to-3.1.x.html
I got this error GraphQL error : Schema hasn't been registered for model "user" When I try to execute an authenticated requests with graphql. ⚠️ This error is also reproducible on the REST API.

Steps to reproduce the behavior

  1. Install GraphQL plugin
  2. Create a collection "ex trip"
  3. Configure Roles & Permissions, In "Authenticated" role check trip>find
  4. Go to http://localhost:1337/graphql
  5. Get a fresh token by executing the login mutation
mutation login($identifier: String!, $password: String!) {
  login(input: { identifier: $identifier, password: $password }) {
    jwt
    user {
      id
      username
      email
    }
  }
}
  1. In the console set HTTP headers with jwt token generated by the mutation above
{
  "Authorization":"Bearer XXX"
}
  1. Execute this query
query trips{
  trips{
    title
  }
}

Expected behavior
Should return a result

Screenshots
Capture d’écran 2020-07-29 à 19 47 36

Capture d’écran 2020-07-29 à 19 50 09

Additional context

System

  • Node.js version:v12.13.0
  • NPM version: 6.14.6
  • Strapi version: v3.1.2
  • Database: mongo
  • Operating system: mac OS X
@devaublanc devaublanc changed the title GraphQL error : Schema hasn't been registered for model "user" Regression v1.3.x | GraphQL error : Schema hasn't been registered for model "user" Jul 29, 2020
@devaublanc devaublanc changed the title Regression v1.3.x | GraphQL error : Schema hasn't been registered for model "user" Regression v3.1.x | GraphQL error : Schema hasn't been registered for model "user" Jul 29, 2020
@devaublanc devaublanc changed the title Regression v3.1.x | GraphQL error : Schema hasn't been registered for model "user" Migration v3.1.x | GraphQL error : Schema hasn't been registered for model "user" Jul 29, 2020
@mikelmi
Copy link

mikelmi commented Jul 30, 2020

+1
The same bug after installing the new version

@devaublanc
Copy link
Contributor Author

Any one got the error code 401 with message The model administrator can't be found.?

Nop

@nikitindiz
Copy link

nikitindiz commented Jul 30, 2020

Same for REST /users/me endpoint.

Response:

{
    "statusCode": 401,
    "error": "Unauthorized",
    "message": "Schema hasn't been registered for model \"user\".\nUse mongoose.model(name, schema)"
}

@NiharZanwar
Copy link

I too got the same error message - using v3.1.2. In fact, I tried to replicate the exact same settings for v3.1.1, which works fine and does not throw the above response. I am using the HTTP API and not GraphQL.

@devaublanc devaublanc changed the title Migration v3.1.x | GraphQL error : Schema hasn't been registered for model "user" Migration v3.1.2 | GraphQL error : Schema hasn't been registered for model "user" Jul 30, 2020
@devaublanc devaublanc changed the title Migration v3.1.2 | GraphQL error : Schema hasn't been registered for model "user" Migration v3.1.2 | Error : Schema hasn't been registered for model "user" Jul 30, 2020
@RileyMShea
Copy link
Contributor

RileyMShea commented Jul 30, 2020

I am also getting this error with mongodb and graphql on v3.1.2. Have not tried REST endpoint yet. It seems I will need to downgrade to v3.1.1 until a patch is out, as this completely breaks site authentication.

@luvvvdev
Copy link

Yes, I have a similar problem for /users/me

{ "statusCode": 401, "error": "Unauthorized", "message": "Schema hasn't been registered for model \"user\".\nUse mongoose.model(name, schema)" }

alexandrebodin added a commit that referenced this issue Jul 31, 2020
gilfernandes pushed a commit to onepointconsulting/strapi that referenced this issue Aug 13, 2020
fix regression issue due to pull strapi#7204

Signed-off-by: Akash P <aksdevac@gmail.com>
Signed-off-by: Gil Fernandes <gil.fernandes@onepointltd.com>
derrickmehaffy pushed a commit that referenced this issue Aug 17, 2020
* Cleanup shelljs

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

* Bump koa-session from 5.13.1 to 6.0.0 (#7254)

Bumps [koa-session](https://github.com/koajs/session) from 5.13.1 to 6.0.0.
- [Release notes](https://github.com/koajs/session/releases)
- [Changelog](https://github.com/koajs/session/blob/master/History.md)
- [Commits](koajs/session@5.13.1...6.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix #7252: fix relation name
fix regression issue due to pull #7204

Signed-off-by: Akash P <aksdevac@gmail.com>

* v3.1.3

* Add React Integration

* Remove character

* Created a new component for less code

* Review modifications

* Review modifications 2

* Add Vue.js, Next.js, Nuxt.js, Gatsby and GraphQL inte

* Change Select with Checkboxes

* Remove useless fonction in Next.js

* Update Next.js

* Update Next.js 2

* Update Vue.js and Nuxt.js

* Update React and Next.js

* Update Post example

* Update all

* Last reviews

Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com>
Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Akash P <aksdevac@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants