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

Access denied on relationship fields connection #8759

Open
molotow11 opened this issue Aug 11, 2023 · 1 comment
Open

Access denied on relationship fields connection #8759

molotow11 opened this issue Aug 11, 2023 · 1 comment

Comments

@molotow11
Copy link

I am trying to connect images to my object with sudo context.
Used the following code:

  const context = req.KeystoneContext;
  const localDb = context.sudo().db;

  try {
    await localDb.Motif.updateOne({
      where: { sku: '027_DE' },
      data: { 
        isImagesMigrated: true, 
        images: { 
          connect: [
            { id: 17674 },
            { id: 17675 },
            { id: 17676 },
            { id: 17677 },
            { id: 17678 }
          ] 
        } 
      }
    });
  }
  catch (error) {
    console.log(error);
    console.log(error.extensions.debug);
  }

And I see the following error:

GraphQLError: An error occured while resolving relationship fields.
  - Motif.images: Access denied: You cannot connect that Image - it may not exist

I've tried to link it manually in admin panel then and it is all fine, so it looks like some bug there.

Screenshot from 2023-08-11 10-30-11

node: v16.20.1
keystone-6/core: v5.5.0

@molotow11
Copy link
Author

Updated:
Direct prisma call works fine

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

No branches or pull requests

1 participant