Driver Error When Adding Device to Application on Open Source Stack

Hi all,

I am currently working on an open source version of The Things Stack v3.24.1. I attempted to create a dummy end device on the web console, however I am running into a “submit failed, driver error” when pressing “Register End Device”.

The web console seems to be able to create applications and load other existing device details fine, but cannot seem to add devices to the database due to some column error.

I’ve tried restarting the stack, stopping/starting the DB, running make init, and rebuilding the frontend according to things mentioned in the github. Only thing I haven’t tried is erasing the DB and initializing with defaults due to wanting to keep existing data.

Given my relative inexperience with Go and full stack development in general, I was wondering if I could get any pointers in solving this issue. I’ve attached the error message below and the API the frontend tried to send. Any help would be greatly appreciated, thanks!

Web Error Message:

  "code": 2,
  "message": "error:pkg/util/store:driver (driver error)",
  "details": [
    {
      "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
      "namespace": "pkg/util/store",
      "name": "driver",
      "message_format": "driver error",
      "correlation_id": "d86b8d42d0674752b02e6746d48bb6ea",
      "code": 2
    }
  ]
}

API Call:

Request URL: http://localhost:1885/api/v3/applications/cap-test/devices
Request Method: POST
Status Code: 500 Internal Server Error
Payload: {
"end_device":
{"ids":{"dev_eui":"0000000000000001","dev_addr":"017FEE2B","device_id":"testenddev1","application_ids":{"application_id":"cap-test"}},
"network_server_address":"localhost","application_server_address":"localhost","join_server_address":"localhost"},
"field_mask":{"paths":["network_server_address","application_server_address","join_server_address"]}
}

Bash output:

WARN    Finished unary call     {"auth.token_id": [omitted], "auth.token_type": "AccessToken", "auth.user_id": "admin", "driver_code": "42703", "driver_message": "column \"serial_number\" of relation \"end_devices\" does not exist", "duration": 0.0183, "error": "error:pkg/util/store:driver (driver error)", "error_correlation_id": "3ef23fea837a4f2a8e7aaa2c8aa21d8e", "error_name": "driver", "error_namespace": "pkg/util/store", "grpc.method": "Create", "grpc.request.application_id": "cap-test", "grpc.request.device_id": "testenddev1", "grpc.service": "ttn.lorawan.v3.EndDeviceRegistry", "grpc_code": "Unknown", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "127.0.0.1", "request_id": "01H1A88P000D2MEZ6M62HEWHGX"}
ERROR   Server error    {"auth.token_id": [omitted], "auth.token_type": "AccessToken", "duration": 0.0198, "http.method": "POST", "http.path": "/api/v3/applications/cap-test/devices", "http.status": 500, "namespace": "web", "peer.address": "127.0.0.1:50892", "request_id": "01H1A88P000D2MEZ6M62HEWHGX"}
go.thethings.network/lorawan-stack/v3/pkg/log.(*zapHandler).HandleLog
        /home/user/lorawan-stack/pkg/log/zap_handler.go:84
go.thethings.network/lorawan-stack/v3/pkg/log.(*Logger).Use.func1
        /home/user/lorawan-stack/pkg/log/logger.go:55
go.thethings.network/lorawan-stack/v3/pkg/log.HandlerFunc.HandleLog
        /home/user/lorawan-stack/pkg/log/handler.go:38
go.thethings.network/lorawan-stack/v3/pkg/log/middleware/observability.(*observability).Wrap.func1
        /home/user/lorawan-stack/pkg/log/middleware/observability/observability.go:86
go.thethings.network/lorawan-stack/v3/pkg/log.HandlerFunc.HandleLog
        /home/user/lorawan-stack/pkg/log/handler.go:38
go.thethings.network/lorawan-stack/v3/pkg/log.(*Logger).commit
        /home/user/lorawan-stack/pkg/log/logger.go:75
go.thethings.network/lorawan-stack/v3/pkg/log.(*entry).commit
        /home/user/lorawan-stack/pkg/log/entry.go:69
go.thethings.network/lorawan-stack/v3/pkg/log.(*entry).Error
        /home/user/lorawan-stack/pkg/log/entry.go:94
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.Log.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/log.go:94
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.SecurityHeaders.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/security_headers.go:27
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.MaxBody.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/max_body.go:35
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.Metadata.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/metadata.go:43
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.ProxyHeaders.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/proxy_headers.go:109
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.RequestID.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/request_id.go:36
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.RequestURL.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/request_url.go:28
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.Peer.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/peer.go:34
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.FillContext.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/fillcontext.go:34
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webmiddleware.Recover.func1.1
        /home/user/lorawan-stack/pkg/webmiddleware/recover.go:49
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
go.thethings.network/lorawan-stack/v3/pkg/webhandlers.WithErrorHandlers.func1.1
        /home/user/lorawan-stack/pkg/webhandlers/error.go:74
net/http.HandlerFunc.ServeHTTP
        /home/user/go/src/net/http/server.go:2109
github.com/gorilla/mux.(*Router).ServeHTTP
        /home/user/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210
go.thethings.network/lorawan-stack/v3/pkg/web.(*Server).ServeHTTP
        /home/user/lorawan-stack/pkg/web/web.go:309
go.thethings.network/lorawan-stack/v3/pkg/component.(*Component).ServeHTTP
        /home/user/lorawan-stack/pkg/component/component.go:428
golang.org/x/net/http2/h2c.h2cHandler.ServeHTTP
        /home/user/go/pkg/mod/golang.org/x/net@v0.5.0/http2/h2c/h2c.go:125
net/http.serverHandler.ServeHTTP
        /home/user/go/src/net/http/server.go:2947
net/http.(*conn).serve
        /home/user/go/src/net/http/server.go:1991

You need to run ttn-lw-stack is-db migrate to setup the necessary database columns.

1 Like

That worked, thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.