Issue upgrading to latest libraries, model not displayed in definition.js

Hello!
I used the ComposeDBExample (GitHub - ceramicstudio/ComposeDbExampleApp) and adapted it to implement discussion on dao proposals in my application. I created a new model proposals needed for my application:
"type BasicProfile @loadModel(id: “$PROFILE_ID”) {
id: ID!
}

type Proposals @createModel(accountRelation: LIST, description: “A Dbrains proposal”)
@createIndex(fields: [{ path: “aragonProposalID” }]) {
title: String! @string(minLength: 1, maxLength: 100)
summary: String! @string(minLength: 1, maxLength: 100)
description: String! @string(minLength: 1, maxLength: 100)
aragonProposalID: String! @string(minLength: 1, maxLength: 200)
created: DateTime!
edited: DateTime!
profileId: StreamID! @documentReference(model:“BasicProfile”)
profile: BasicProfile! @relationDocument(property: “profileId”)
}"

I updated the composites.mjs script accordingly to deploy the new model in relation to the others from composeDbExample:
"export const writeComposite = async (spinner) => {
await authenticate();
const profileComposite = await createComposite(
ceramic,
“./composites/00-basicProfile.graphql”
);

console.log(“profileComposite.modelIDs:”, profileComposite.modelIDs);

const proposalsSchema = readFileSync(“./composites/00-proposals.graphql”, {
encoding: “utf-8”,
}).replace(“$PROFILE_ID”, profileComposite.modelIDs[0]);

const proposalsComposite = await Composite.create({
ceramic,
schema: proposalsSchema,
});

console.log(“proposalsComposite.modelIDs:”, proposalsComposite.modelIDs);

const postsSchema = readFileSync(“./composites/01-posts.graphql”, {
encoding: “utf-8”,
})
.replace(“$PROFILE_ID”, profileComposite.modelIDs[0])
.replace(“$PROPOSAL_ID”, proposalsComposite.modelIDs[1]);

const postsComposite = await Composite.create({
ceramic,
schema: postsSchema,
});

const followingSchema = readFileSync(“./composites/02-following.graphql”, {
encoding: “utf-8”,
}).replace(“$PROFILE_ID”, profileComposite.modelIDs[0]);

const followingComposite = await Composite.create({
ceramic,
schema: followingSchema,
});

const postProfileSchema = readFileSync(
“./composites/03-postsProfile.graphql”,
{
encoding: “utf-8”,
}
)
.replace(“$POSTS_ID”, postsComposite.modelIDs[2])
.replace(“$PROFILE_ID”, profileComposite.modelIDs[0]);

console.log(“postsComposite.modelIDs:”, postsComposite.modelIDs);
console.log(“profileComposite.modelIDs:”, profileComposite.modelIDs);

const postsProfileComposite = await Composite.create({
ceramic,
schema: postProfileSchema,
});

const commentsSchema = readFileSync(“./composites/04-comments.graphql”, {
encoding: “utf-8”,
})
.replace(“$POSTS_ID”, postsComposite.modelIDs[2])
.replace(“$PROFILE_ID”, profileComposite.modelIDs[0]);

const commentsComposite = await Composite.create({
ceramic,
schema: commentsSchema,
});

console.log(“commentsComposite.modelIDs:”, commentsComposite.modelIDs);

const commentsPostsSchema = readFileSync(
“./composites/05-commentsPosts.graphql”,
{
encoding: “utf-8”,
}
)
.replace(“$COMMENTS_ID”, commentsComposite.modelIDs[2])
.replace(“$POSTS_ID”, postsComposite.modelIDs[1]);

const commentsPostsComposite = await Composite.create({
ceramic,
schema: commentsPostsSchema,
});

const composite = Composite.from([
profileComposite,
proposalsComposite,
postsComposite,
followingComposite,
postsProfileComposite,
commentsComposite,
commentsPostsComposite,
]);

await writeEncodedComposite(composite, “./src/generated/definition.json”);
spinner.info(“creating composite for runtime usage”);
await writeEncodedCompositeRuntime(
ceramic,
“./src/generated/definition.json”,
“./src/generated/definition.js”
);
spinner.info(“deploying composite”);
const deployComposite = await readEncodedComposite(
ceramic,
“./src/generated/definition.json”
);

await deployComposite.startIndexingOn(ceramic);
spinner.succeed(“composite deployed & ready for use”);
};"

It was working fine until I updated ceramic libraries in order to implement the session login using web3modal and walletConnect as described in the latest example of MarkZK (GitHub - ceramicstudio/walletconnect-tutorial: A demo application that coincides with a separate tutorial that shows how WalletConnect's Web3Modal can be used with Ceramic to create authenticated user sessions.).
I updated libraries from:
“”@ceramicnetwork/blockchain-utils-linking": “2.11.0”,
@ceramicnetwork/cli”: “2.38.0”,
@ceramicnetwork/common”: “2.33.0”,
@ceramicnetwork/http-client”: “2.30.0”,
@composedb/cli”: “0.5.0”,
@composedb/client”: “0.5.0”,
@composedb/devtools”: “0.5.0”,
@composedb/devtools-node”: “0.5.0”,
@didtools/cacao”: “2.0.0”,
@didtools/pkh-ethereum”: “0.1.0”,
“did-session”: “^1.0.0”,
“dids”: “^3.2.0”,"
to:
@ceramicnetwork/blockchain-utils-linking”: “3.2.0”,
@ceramicnetwork/cli”: “^3.2.0”,
@ceramicnetwork/common”: “^3.2.0”,
@ceramicnetwork/http-client”: “^3.2.0”,
@composedb/cli”: “^0.6.0”,
@composedb/client”: “^0.6.0”,
@composedb/devtools”: “^0.6.0”,
@composedb/devtools-node”: “^0.6.0”,
@didtools/cacao”: “2.0.0”,
@didtools/pkh-ethereum”: “^0.4.1”,
“did-session”: “^3.0.2”,
“dids”: “^3.2.0”,".

After the update, I got the error:" Unhandled Runtime Error
Error: Model not found for relation with ID kjzl6hvfrbw6c9dlyxlrdr14p9heu6fb6blss50d4mjftjz01iegqfgnjquotqf on field proposals"
and the proposals model is not showing up in models in definition.js.
Any idea where it can come from and how to fix it?
Thanks

1 Like

Hey @brunolune. Thank you for reaching out here. @Radek, can you have a look at this issue?

@brunolune - I believe the issue might be related to the type of quotation marks you were using in your schema definitions. When I tried based on what you shared above, I also encountered an issue. When I switched back to regular double quotes, no issue occurred.

I made this branch for you: GitHub - ceramicstudio/composite-deploy-boilerplate at bruno-fix

It works fine when you run the deploy script (npm run testOne)

2 Likes

@brunolune please let us know if this resolved the problem on your end. It’s an interesting issue we haven’t encountered earlier, it’s hard to pinpoint the problem, and there may be more people with the same problem. We need to think about how to make sure it doesn’t happen to others, too.

Hello,
I am using regular double quote in my code. I think the double quotes in the post comes from a formatting that took place when I copied/pasted the code in a text editor before copying/pasting again to the forum post. Thus I don’t think that the problem I got is due to this.

Yea Sure! Let me know how I can help you to find the issue. Thanks!

I made a new branch bruno-fix-2 in the repo. It uses the same libraries as in the repo, although they slightly differ from the libraries I used (@ceramicnetwork @4.1.0 instead of @3.2.0), the error is the same if I upgrade to @4.1.0 in my code. “npm run testThree” reproduces the error with the same composites and composites.mjs as in my code. The proposals model does not show up in the model in definition.js.

@brunolune would you mind pushing the changes you made up into a repo and sharing the link with us? @Radek would you be able to check what Bruno shares when it becomes available please?

npm run testThree

hi @brunolune - on line 98 of /scripts/compositesThree.mjs you have the following:

 .replace("$POSTS_ID", postsComposite.modelIDs[1]);

This must be replaced with

.replace("$POSTS_ID", postsComposite.modelIDs[2]);

this fixes the issue for me

1 Like

Hello Mark! Yes it solved the problem indeed. Thanks! Not sure though why I didn’t get the issue with the previous libraries. Everything seemed to work fine so I hadn’t detected this error.

Apologies for the back and forth - you will need to downgrade your ceramic packages to v3 - v4 is not compatible yet with the composeDB versions you’re running

1 Like

Okay, thanks! I changed packages to :
@ceramicnetwork/blockchain-utils-linking”: “3.3.0”,
@ceramicnetwork/cli”: “^3.3.0”,
@ceramicnetwork/common”: “^3.3.0”,
@ceramicnetwork/http-client”: “^3.3.0”,
@composedb/cli”: “^0.6.0”,
@composedb/client”: “^0.6.0”,
@composedb/devtools”: “^0.6.0”,
@composedb/devtools-node”: “^0.6.0”,
@didtools/cacao”: “3.0.1”,
@didtools/pkh-ethereum”: “^0.5.0”,
“did-session”: “^3.0.2”,
“dids”: “^5.0.2"”

and it works fine again now!

2 Likes

Sweet! @Radek i converted this into a ticket for you with bruno’s pr, see if we still want to incorporate that? thx!