Skip to content

Index out of bounds when creating a relation with a stripe foreign table #519

Open
@thomtrp

Description

@thomtrp

Describe the bug

Hello, I am from Twenty core team. I am using stripe foreign data wrapper.

I created a foreign table customer (based on stripe customers) and it worked well, my data are available as expected.

But I have an issue when I try to create a relationship with one of my local object using pg_graphql.

Following the supabase doc, I tried to create a relation with my local object favorite. When trying to fetch the customers linked to a given favorite, it results with an error:

index out of bounds: the len is 1 but the index is 18446744073709551615

To Reproduce

Steps to reproduce the behavior:

  1. Using stripe foreign data wrapper, create a foreign table based on a stripe object
  2. Follow the supabase doc to create a relation with a local table. In my case I did:
  • Created a comment on the foreign table customer @graphql({"primary_key_columns": ["id"], "totalCount": {"enabled": true}})
  • Added a customerId field on my table favorite
  • Created a comment on my table favorite so it knows customerId is a foreign key @graphql({"totalCount":{"enabled":true},"foreign_keys":[{"local_name":"favoriteCollection","local_columns":["customerId"],"foreign_name":"customer","foreign_schema":"my_schema","foreign_table":"customer","foreign_columns":["id"]}]})
  1. Run a query that will test the relation. In my case that was:
query {
  favoriteCollection(filter: {workspaceMemberId:{eq:"123"}}) {
    edges {
      node {
        customer {
          id: id
        }
     }
   }
  }
}

Expected behavior

Customer object should be returned properly.

Additional context

If I add another object to fetch that would be working without customer, the query stops failing but customer is not returned:

query {
  favoriteCollection(filter: {workspaceMemberId:{eq:"123"}}) {
    edges {
      node {
        company {
          id: id
        }
        customer {
          id: id
        }
     }
   }
  }
}

If I add again another object to fetch, the error changes to: index out of bounds: the len is 1 but the index is 1

query {
  favoriteCollection(filter: {workspaceMemberId:{eq:"123"}}) {
    edges {
      node {
        company {
          id: id
        }
        user {
          id: id
        }
        customer {
          id: id
        }
     }
   }
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions