Extend users-permissions with relation field and return data in GraphQL

System Information
  • Strapi Version: 4.0.5
  • Operating System: Mac OS 12.1
  • Database: Postgres 13
  • Node Version: 14.17.1
  • Yarn Version: 1.22.17

Hi all,

I added a relation field in users-permissions and extended the type in nexus. However, the result of GraphQL returns empty data.

src/extensions/index.js

'use strict';

module.exports = {
  /**
   * An asynchronous register function that runs before
   * your application is initialized.
   *
   * This gives you an opportunity to extend code.
   */
  register({ strapi }) {
    const extensionService = strapi.plugin('graphql').service('extension');
    extensionService.use(({ nexus }) => ({
      types: [
        nexus.extendType({
          type: 'UsersPermissionsMe',
          definition(t) {
            t.string('name');
            t.field('restaurant', { type: 'RestaurantEntityResponse' });
          },
        }),
      ]
    }));
  },

  /**
   * An asynchronous bootstrap function that runs before
   * your application gets started.
   *
   * This gives you an opportunity to set up your data model,
   * run jobs, or perform some special logic.
   */
  bootstrap(/*{ strapi }*/) { },
};

GraphQL Playground

Is there something I’m missing in order to make it work?

Thank you.

where you able to resolve your problem ? cause I’m in the same situation now

Any luck? I’m having the same issue?