streamingfast / substreams-sink-kv

Substreams KV sink
Apache License 2.0
2 stars 5 forks source link

Getting couldn't find flag "api-prefix" error when running wasm example #28

Closed chamorin closed 1 year ago

chamorin commented 1 year ago

When I run this command from the wasm-query-service example:

substreams-sink-kv inject --endpoint mainnet.eth.streamingfast.io:443 "badger3://badger_data.db" substreams.yaml --listen-addr=":9000"

I'm getting this error:

panic: flags: couldn't find flag "api-prefix"

goroutine 1 [running]:
main.mustGetString(0x7?, {0x1ec5e79, 0xa})
        github.com/streamingfast/substreams-sink-kv/cmd/substreams-sink-kv/utils.go:78 +0x9d
main.setupServer(0xc000a1f080?, 0xc00095fe40, 0xc000884460)
        github.com/streamingfast/substreams-sink-kv/cmd/substreams-sink-kv/serve.go:131 +0x1a5
main.injectRunE(0xc000005500, {0xc0000d0d20, 0x2, 0x0?})
        github.com/streamingfast/substreams-sink-kv/cmd/substreams-sink-kv/inject.go:93 +0xb36
github.com/streamingfast/cli.silenceUsageOnError.func1(0xc000005500, {0xc0000d0d20?, 0x2?, 0x5?})
        github.com/streamingfast/cli@v0.0.4-0.20230420210357-3bebdb9f2fbf/cli.go:421 +0x2b
github.com/spf13/cobra.(*Command).execute(0xc000005500, {0xc0000d0c80, 0x5, 0x5})
        github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004c00)
        github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.6.1/command.go:968
github.com/streamingfast/cli.Run({0x1ed46fd?, 0x5?}, {0x1ed3665?, 0x456385?}, {0xc00099ff10?, 0xc000098738?, 0x47afbb?})
        github.com/streamingfast/cli@v0.0.4-0.20230420210357-3bebdb9f2fbf/cli.go:292 +0x50
main.main()
        github.com/streamingfast/substreams-sink-kv/cmd/substreams-sink-kv/main.go:25 +0x145

Also, the command example is: substreams-sink-kv inject -e mainnet.eth.streamingfast.io:443 "badger3://$(pwd)/badger_data.db" substreams.yaml but the -e option is no longer working and was replaced by --endpoint

I'm using substreams-sink-kv version 2.0.0

maoueh commented 1 year ago

You should be good with substreams-sink-kv inject mainnet.eth.streamingfast.io:443 "badger3://badger_data.db" substreams.yaml --listen-addr=":9000" now. I release 2.1.0 which contains this breaking change.

Let me know.

chamorin commented 1 year ago

Thanks for the update 👍

However, when I run the command I get this error:

ERRO (sink-kv) unable to setup sinker: sink module is required in sink config

What's the sink config?

maoueh commented 1 year ago

It's a Substreams manifest that defines some information so that a sinker can pick it up automatically from the manifest:

specVersion: v0.1.0
package:
  name: "substreams_eth_block_meta"
  version: v0.4.0

imports:
  sink_kv: https://github.com/streamingfast/substreams-sink-kv/releases/download/v0.1.2/substreams-sink-kv-v0.1.2.spkg
  blockmeta: https://github.com/streamingfast/substreams-eth-block-meta/releases/download/v0.4.1/substreams-eth-block-meta-v0.4.1.spkg

sink:
  module: blockmeta:kv_out
  type: sf.substreams.sink.kv.v1.GenericService

This one for example has a sink config that defines what the sink should call (in this case defines a sink of type sf.substreams.sink.kv.v1.GenericService and the module to be sinked is blockmeta:kv_out).

If your substreams.yaml/spkg don't have a sink config (like https://github.com/streamingfast/substreams-eth-block-meta/releases/download/v0.4.1/substreams-eth-block-meta-v0.4.1.spkg), use the flag -m kv_out to specify which module to sink.

chamorin commented 1 year ago

Getting unknown shorthand flag: 'm' in -m what's the replacement for the -m flag?

chamorin commented 1 year ago

I tried --module but it returns me the same error:

ERRO (sink-kv) unable to setup sinker: sink module is required in sink config
chamorin commented 1 year ago

My bad it was an issue on my side (I wasn't using the right substream). However, when I try to run the command:

substreams-sink-kv inject mainnet.eth.streamingfast.io:443 "badger3://badger_data.db" substreams.yaml --listen-addr=":9000"

with the wasm example I get this error:

ERRO (sink-kv) Flag "api-prefix" does not exist
maoueh commented 1 year ago

Can you give me the exact command and in which folder you are?

maoueh commented 1 year ago

Also provide me with:

maoueh commented 1 year ago

Please also run those command in the same directory that is causing you some problem.

chamorin commented 1 year ago

I'm using substreams-sink-kv version 2.1.1, it's located in my /usr/local/bin/ and the folder in which I'm running this command:

substreams-sink-kv inject mainnet.eth.streamingfast.io:443 "badger3://badger_data.db" substreams.yaml --listen-addr=":9000"

is this: substreams-sink-kv/examples/wasm-query-service, from the wasm example

chamorin commented 1 year ago

Downloaded release 2.1.2 and tried it with the same command and in the same folder as above but I'm getting this error:

ERRO (sink-kv) unable to retrieve cursor: invalid cursor

Is there something missing to my command?

maoueh commented 1 year ago

Yeah I noticed the same, clearing the database seems to do the trick. But this means there is something fishy and the cursor is invalid somehow.

I'll need to dig that deeper. Closing this one since the original issue is good now.

maoueh commented 1 year ago

rm -rf "./badger_data.db"