Records for current filter not found, EntityNotFoundError

Hi,
I’ve a big problem on my createOrganizationAfter trigger. I want to connect a stripe user to an organization.

Unhandled error: {"message":"Records for current filter not found","locations":[],"path":["stripeCustomerCreate"],"code":"EntityNotFoundError","details":{"organization":"Record for current filter not found."}}

The thing is that it putting me this error. Is this something with the one-to-one relation wich has been changed recently ?
The field org does really exist in my stripeCustomer schema. The trigger is working on local but not on production…

This is quite urgent. If someone or the support can help.

Thanks in advance

Hi @ronan!
Its Igor from 8base
Can you please share your trigger source code?
One important note: It is not advisable to use triggers in order to create other entities or change the current and others, because it may cause unpredictable side effects and locks of database (docs reference)

You can move your logic to Resolver and make the steps sequentially like this:

const { organization } = await ctx.api.gqlRequest(CREATE_ORG_MUTATION, {
    data,
  });

  const orgId = organization?.id;

  const { stripeCustomer } = await ctx.api.gqlRequest(
    STRIPE_CUSTOMER_UPDATE_MUTATION,
    {
      id: stripeCustomerId,
      organization: {
        connect: {
          id: orgId,
        },
      },
    }
  );
1 Like

Hi ! Thanks for you reply ! it worked…
Could you tell me what’s the reason 8base deleted the one-to-one relationship ?
To me it was very usefull, I don’t know how to do instead…

@ronan We released a big update to our database to improve performance. Conceptually, relational databases do not support 1 to 1 relationships. So we removed this feature
But you can still create a kind of 1-to-1 relation:

  1. Create a new relation field in the table
  2. Go to Table Settings (Setting Icon near the Data tab)
  3. Press “Add Index”
  4. Choose your relation and give it a name
  5. Select “Unique Index”

It will guarantee that the field will have only one relation

Let me know if you have any questions

Igor

2 Likes