Skip to content

I can't access custom field from from users/me via GraphQL #4878

@geosigno

Description

@geosigno

Hi,

Describe the bug
I can't access some data via GraphQL versus simple fetch.

Steps to reproduce the behavior
1- Create a new avatar media field on users.
2- Try to get that avatar via the below GraphQL query:

query {
  me {
    username
    avatar {url}
  }
}

3)- You'll get the below error:
"Cannot query field "avatar" on type "UsersPermissionsMe"." with a GRAPHQL_VALIDATION_FAILED code.

Code snippets
The below fetch if returning the avatar object:

http://localhost:1337/users/me/

{
    "id": 20,
    "username": "***",
    "email": "***@gmail.com",
    "provider": "local",
    "confirmed": true,
    "blocked": null,
    "created_at": "2019-12-26T19:17:36.847Z",
    "updated_at": "2020-01-01T20:11:46.181Z",
    "avatar": {
        "id": 12,
        "url": "/uploads/8dd5de998ffa4de09fc264c0fab924ab.jpg"
    }
}

System

  • Node.js version: 10.17.0
  • NPM version: 6.11.3
  • Strapi version: v3.0.0-beta.18.3
  • Database: sqlite
  • Operating system: macod

Expected behavior
I should be able to get the avatar data from GraphQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solvesource: plugin:graphqlSource is plugin/graphql packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions