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

Duplicate Index Creation Error in js-ceramic with ceramic-one #225

Open
ahadjeres opened this issue Jul 9, 2024 · 0 comments
Open

Duplicate Index Creation Error in js-ceramic with ceramic-one #225

ahadjeres opened this issue Jul 9, 2024 · 0 comments

Comments

@ahadjeres
Copy link

Summary:
Encountered a duplicate index creation error while using js-ceramic . The error occurs when creating a composite, indicating that an index already exists. The issue arises even on a fresh local Ceramic node with no previous models loaded.

Steps to Reproduce:

  1. Set up a fresh local Ceramic node.
  2. Execute the following command to create a composite:
    npx composedb composite:compile 
  3. Observe the error indicating that the index already exists.

Observed Error Message:

Error: HTTP request to 'http://localhost:7007/api/v0/admin/modelData' failed with status 'Internal Server Error': {"error":"CREATE INDEX idx_v2jh5luud0_chain ON kjzl6hvfrbw6c5bmbxt6exlnu4kggb6tmoijnmvtcq0mjjvk4jhobv2jh5luud0 (json_extract(stream_content, '$.chainName')) - SQLITE_ERROR: index idx_v2jh5luud0_chain already exists"}

Analysis:

  • The error suggests that composedb is attempting to create the same index twice.
  • This occurs when adding the following lines to the models:
    @createIndex(fields: [{ path: "createdOn" }])
    @createIndex(fields: [{ path: "updatedOn" }])
  • These indexes are added to three different models, which should not typically cause a conflict as each model corresponds to a different table.

Code Snippet:

+++ b/packages/composedb/models/OamoCredentialRelation.graphql
@@ -11,8 +11,12 @@ type OamoCredential
  ...
  @createIndex(fields: [{ path: "createdOn" }])
  @createIndex(fields: [{ path: "updatedOn" }]) {
  ...
@@ -30,9 +34,12 @@ type OamoPublicProfile
  ...
  @createIndex(fields: [{ path: "createdOn" }])
  @createIndex(fields: [{ path: "updatedOn" }]) {
  ...
@@ -46,7 +53,9 @@ type OamoCredentialRelation
  ...
  @createIndex(fields: [{ path: "createdOn" }])
  @createIndex(fields: [{ path: "updatedOn" }]) {
  ...

Possible Causes:

  • Duplicate index creation due to composedb trying to create indexes with the same name across different models.
  • Potential issue with handling of circular relations or index naming conflicts within composedb.

Next Steps:

  • Investigate if the GraphQL schema or composedb configuration has any rules or limitations regarding circular relations or index naming.
  • Determine if there are any existing indexes that conflict with the new ones being created.
  • Debug by removing indexes and relations one by one to identify the exact cause.

References:

  • Diff between the branches indicating the changes that led to the error.
  • Conversations with team members to isolate the problem.
@ahadjeres ahadjeres changed the title Bug Ticket: Duplicate Index Creation Error in js-ceramic without Recon Bug Ticket: Duplicate Index Creation Error in js-ceramic with ceramic-one Jul 9, 2024
@ahadjeres ahadjeres changed the title Bug Ticket: Duplicate Index Creation Error in js-ceramic with ceramic-one Duplicate Index Creation Error in js-ceramic with ceramic-one Jul 9, 2024
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