Specify data rate when simulating an uplink message


I’m used the lora server on localhost (it works good on localhost), and I just deployed it to a server.

I have the same docker-compose file, and the same config in the GUI. But I get this message:

loraserver_1 | time="2018-02-20T10:14:09Z" level=error msg="processing rx packet error: get data-rate error: lorawan/band: the given data-rate does not exist" data_base64="gCrK4QYAAQABzXAkKBj9I+FyFZ5o1h6kvvrjcLg="

I have no idea what to change, if it’s in my code or in the GUI.

test := `{"allInfo": 10"}`
a := []byte(test)

client := lora.CreateConnection(configLora)
payload, err := GeneratePhyLoad(config, a)
logging.Log().Debug("Payload: ", litter.Sdump(payload))
logging.Log().Debug("Payload (string): ", string(payload))

if err != nil {
	return err

message := lora.GenerateMessage(payload, configLora.GatewayMac)
logging.Log().Debug("Message: ", litter.Sdump(message))

pErr := lora.Publish(client, "gateway/"+configLora.GatewayMac+"/rx", message)

And the functions:

func GeneratePhyLoad(config *GeneralConfig, payload []byte) ([]byte, error) {

	phy := lorawan.PHYPayload{
		MHDR: lorawan.MHDR{

			MType: lorawan.ConfirmedDataUp,
			Major: lorawan.LoRaWANR1,
		MACPayload: &lorawan.MACPayload{
			FHDR: lorawan.FHDR {
				DevAddr: lorawan.DevAddr(config.DevAddr),
				FCnt:    1,
			FPort:      &config.FPort,
			FRMPayload: []lorawan.Payload{&lorawan.DataPayload{Bytes: payload}},

	if err := phy.EncryptFRMPayload(config.AppSKey); err != nil {
		return nil, err

	if err := phy.SetMIC(config.NwkSKey); err != nil {
		return nil, err

	bytes, err := phy.MarshalText()

	if err != nil {
		return nil, err

	return bytes, nil

func GenerateMessage(payload []byte, gwMac string) *Message {

	dataRate := &DataRate{
		Bandwidth:    500,
		Modulation:   "LORA",
		SpreadFactor: 8,
		BitRate:      0}

	rxInfo := &RxInfo{
		Channel:   0,
		CodeRate:  "4/5",
		CrcStatus: 1,
		DataRate:  dataRate,
		Frequency: 902300000,
		LoRaSNR:   7,
		Mac:       gwMac,
		RfChain:   1,
		Rssi:      -57,
		Size:      23,
		Time:      time.Now().Format(time.RFC3339),
		Timestamp: int32(time.Now().UnixNano() / 1000000000)}

	message := &Message{
		PhyPayload: string(payload),
		RxInfo:     rxInfo}

	return message

Any ides?

Here is a picture from the GUI:

Seems to be correct in the database as well:

I also have the same Factory-present frequencies (902300000) in the device profile (but it seems not to be saved if I change view in the GUI).

Is the message generated in the wrong way? It’s weird because I have the same config works fine on localhost, I must have missed anything.

I solved it by using the same structure found in here: