Strapi V4: can't access custom fields from users/me via Graphql

System Information
  • Strapi Version: 4.0.0
  • Operating System: Windows 10
  • Database: SQL lite
  • Node Version: 14.16.1
  • NPM Version: 6.14.12
  • Yarn Version: 1.22.10


I’m having the exact issue related in this github issue : I can't access custom field from from users/me via GraphQL · Issue #4878 · strapi/strapi · GitHub
Additional fields in user content-type won’t show up querying /me via graphql.
It seems to be because the /me Schema is strict, hard coded.

There are lot of solutions working for the V3 (this one for instance : GraphQL query "me" get related content · Issue #2627 · strapi/strapi · GitHub) but i’m a bit lost applying these fixes in the V4.

For now, the only thing I did that got me some results, was to edit the file “@strapi\plugin-users-permissions\server\graphql\types\me.js”, the goal being to add my custom fields to the UsersPermissionMe Schema :

'use strict';

module.exports = ({ nexus }) => {
  return nexus.objectType({
    name: 'UsersPermissionsMe',

    definition(t) {'id');
      t.field('role', { type: 'UsersPermissionsMeRole' });

But this is an edit in the node_module files, I can’t find in the doc how to extend these schema the right way.

Any help will be appreciated

Thanks for your time

1 Like

You should be able to extend the type like this.

1 Like