ceramicnetwork / ceramicnetwork/js-ceramic

ERROR: Error: Invalid 'model' metadata property in Model stream

Open
#2,365 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
423
Forks
126
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
### 1
When I call the ` ModelInstanceDocument.create ` method , The server reported an error : `ERROR: Error: Invalid 'model' metadata property in Model stream: kh4q0kq8h3j3zb52p8gjcayuwrdpt`

![27c7f6961342920aa41f4e49f638047](https://user-images.githubusercontent.com/29918052/183631168-a63fa794-c997-4764-b355-1db49c3f0024.jpg)

### 2
But apparently the string `kh4q0kq8h3j3zb52p8gjcayuwrdpt` doesn't match my model stream id (`kjzl6hvfrbw6c59v2kgsss471xbd0wzl2pvy6pj22mcxrkxuzz85vnfbjohw1yo`)

#### Then I added this id to the configuration file: daemon.config.json
``` json
"indexing": {
"db": "postgres://",
"allow-queries-before-historical-sync": true,
"models": [
"kjzl6hvfrbw6c59v2kgsss471xbd0wzl2pvy6pj22mcxrkxuzz85vnfbjohw1yo",
"kh4q0kq8h3j3zb52p8gjcayuwrdpt"
]
```
#### The problem is not solved at this time
### 3
Then I modified the source code and it works fine

![d0bcaa80fa38e4cdbca82e7463905bd](https://user-images.githubusercontent.com/29918052/183631379-e114c883-0db2-45a5-9cb9-5840e5386503.jpg)
disable this line:
https://github.com/ceramicnetwork/js-ceramic/blob/develop/packages/stream-model-handler/src/model-handler.ts#L126

**Ceramic versions**
2.5.0 and 2.5.0-rc.0 and 2.5.0-rc.1

**Machine, OS, browser information (please complete the following information):**
ubuntu

**Additional context**

If I change the order of the models in the configuration file ,eg.:
``` json
"indexing": {
"db": "postgres://",
"allow-queries-before-historical-sync": true,
"models": [
"kh4q0kq8h3j3zb52p8gjcayuwrdpt",
"kjzl6hvfrbw6c59v2kgsss471xbd0wzl2pvy6pj22mcxrkxuzz85vnfbjohw1yo"
]
```

The server report `ERROR: Error while loading commit CID bafyxccyabfug233emvwc25rr from IPFS for stream kh4q0kq8h3j3zb52p8gjcayuwrdpt:HTTPError: potentially insecure hash functions not allowed `
Even modifying the source code won't fix it

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with packages/stream-model-handler/src/model-handler.ts at line 126 and reproduce the ModelInstanceDocument.create failure using the model IDs and daemon.config.json examples. Trace how model metadata and configured model streams are validated, including both configuration orders and the reported insecure-hash error. Done means the reported model configurations no longer fail without disabling the validation line.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.