lf-edge / ekuiper

Lightweight data stream processing engine for IoT edge
https://ekuiper.org
Apache License 2.0
1.47k stars 413 forks source link

Timescale Sink - Error plugin was built with a different version of package golang.org/x/crypto/pbkdf2 #990

Closed tfmeneses closed 3 years ago

tfmeneses commented 3 years ago

Environment:

What happened and what you expected to happen: Plugin Timescale worked

How to reproduce it (as minimally and precisely as possible): Create a plugin with the dependency "github.com/jackc/pgx/v4/pgxpool" Compile and install the plugin

Anything else we need to know?:

MicrosoftTeams-image (3)

tfmeneses commented 3 years ago

timescale.go.txt

cd /go/kuiper go build -trimpath --buildmode=plugin -o extensions/sinks/timescale/Timescale.so extensions/sinks/timescale/timescale.go

vi /tmp/ruletimescale.txt { "sql": "SELECT * from demo", "actions": [ { "timescale":{ "host": "172.17.0.3", "port":"5432", "username": "postgres", "password": "password", "database": "emdata", "table":"devicerecord", "fields": ["temperature","humidity"] } } ] }

ngjaying commented 3 years ago

@tfmeneses The golang plugin requires the same version for packages which are used in the main program and the plugin. Both eKuiper and your plugin(indirectly imported from github.com/jackc/pgx/v4 -> github.com/jackc/pgconn) use golang.org/x/crypto but with different versions...

The plugin may not work in this scenario unless you are able to make your plugin depends on the same version as eKuiper. As a workaroud, you could add your plugin to eKuiper directly as part of it like mqtt sink. To do that, add your code to internal/topo/sink and then add your sink to internal/topo/node/sink_node.go doGetSink function.

ngjaying commented 3 years ago

By the way, we are working on "portable plugin" system to avoid these golang plugin restrictions. You may want to have a look and check if it fits your needs. Check out here

tfmeneses commented 3 years ago

@tfmeneses The golang plugin requires the same version for packages which are used in the main program and the plugin. Both eKuiper and your plugin(indirectly imported from github.com/jackc/pgx/v4 -> github.com/jackc/pgconn) use golang.org/x/crypto but with different versions...

The plugin may not work in this scenario unless you are able to make your plugin depends on the same version as eKuiper. As a workaroud, you could add your plugin to eKuiper directly as part of it like mqtt sink. To do that, add your code to internal/topo/sink and then add your sink to internal/topo/node/sink_node.go doGetSink function.

Excelent. Good know.

The problem was because are missing the 'm.conf = cfg' in configure method. Another think that I executed was:

go build -trimpath -o ./_build/kuiper-1.3.0-linux-amd64/bin/kuiperd cmd/kuiperd/main.go

Thank very much