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

[BUG] camelCase to snake-case conversion issue during graph init #1679

Open
marcusrein opened this issue Jun 6, 2024 · 0 comments
Open

[BUG] camelCase to snake-case conversion issue during graph init #1679

marcusrein opened this issue Jun 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@marcusrein
Copy link
Member

marcusrein commented Jun 6, 2024

Which packages are impacted by your issue?

@graphprotocol/graph-cli

Describe the issue

I attempted to deploy a subgraph on Moonbeam on a live demo today and ran into this error:

✖ Failed to deploy to Graph node https://api.studio.thegraph.com/deploy/: Could not deploy subgraph on graph-node: subgraph deployment error: store error: The `id` field has type `BigInt` but only `String`, `Bytes`, `Int8`, and `ID` are allowed. Deployment: QmRkH3mWEwUxAtg7CHkuVi4sozH8boj2pxkiWFxKGBYryb
UNCAUGHT EXCEPTION: Error: EEXIT: 1

Smart contract address: 0xb89279DEd0AD7cD573D164b03424E1E2BbE1e2Be

The subgraph was an init subgraph and all the schema entity ids are Bytes.

graph-cli is 0.73.0.

I was able to deploy a subgraph that was indexing an ethereum smart contract right afterwards without issue.

@lutter provided context to this issue:

"I see the schema has fields like _id: BigInt (e.g. on EnteredGame) That causes the issue: we internally convert GraphQL field names from camel case to snake case (fieldName -> field_name) The library we use for that unfortunately translates _id to id and that makes graph-node think you have a id: BigInt in your schema. Try renaming those fields, and things should work."

Reproduction

graph-cli

Steps to Reproduce the Bug or Issue

See issue description ⬆️

Expected behavior

graph-cli should continue through its init process.

If this error is unavoidable at this time, an error code could display such as:

Failed to deploy to Graph node: Could not deploy subgraph on graph-node: subgraph deployment error: store error: The `id` field has type `BigInt` but only `String`, `Bytes`, `Int8`, and `ID` are allowed.

Cause: Schema has fields like _id: BigInt, incorrectly converted to id by our internal library, making the graph-node think there is an id: BigInt.

Fix: Rename entity fields to avoid starting with an underscore (_). For example, rename _id to id.

UNCAUGHT EXCEPTION: Error: EEXIT: 1

Screenshots or Videos

No response

Platform

  • OS: MacOS
  • NodeJS: v20.13.1
  • @graphprotocol/graph-cli v0.73.0

Subgraph Manifest

No response

Subgraph GraphQL Schema

No response

Additional context

No response

@marcusrein marcusrein added the bug Something isn't working label Jun 6, 2024
@marcusrein marcusrein changed the title [BUG] camelCase to snake-case conversion issue [BUG] camelCase to snake-case conversion issue during graph init Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Bug
Development

No branches or pull requests

3 participants