How the user input values-text fields, in lora-app-server, post that value to golang at backend?

Hey! So I did what you said, I checked all the versions and the go.mod file, and all of it uses proto3 and I also installed protoc version 3.0.0.
But the same problems and errors still exists.
It seems like it isn’t able to find the imports, while all the imports are already present inside golang/protobuf/ptype.

When I compile my own .proto files using protoc -I command, it works well. But when I run make api from the Makefile on the lora-app-server .proto files, this problem still persists. Why is that? Is there some problem in running go get from github? Is the repo broken? I am not able to understand where am i going wrong.

Sorry, I don’t know. As I said, I don’t know the entire configuration of your machine so I can’t debug this for you. I’d try looking in their github issues for similar problems. I hope you are able to fix it.

1 Like

Hi, So my problem was resolved. Turns out that I have to create a symlink between the protoc binary and/usr/local/bin. After that the API was generated successfully, as it was able to now find all the imports which were previously needed.

But, now I am again facing issues regarding gw.pb.go files. When I try to build lora-app-server, I encounter the following errors:

It is not able to find the AssumeColonVerbOpt function from the runtime package. I tried creating symlinks here too, but in vain. Can you please tell me what can be the reason behind this?

Again, I believe your protoc version doesn’t match the versions of the tools used by lora-app-server.

1 Like

Thank you so much! You were right, it was version incompatibility of the protoc-gen-grpc-gateway. I installed the correct version and all went fine.

But, as I made changes to the /home/network-server/src/github.com/brocaar/lora-app-server/api/deviceQueue.proto file and the respective/home/network-server/src/github.com/brocaar/lora-app-server/ui/src/stores/DeviceQueueStore.js file and /home/network-server/src/github.com/brocaar/lora-app-server/internal/api/external/device_queue.go file and ran make api, and make build; everything ran smoothly and I was able to get my endpoint in the localhost:8080/api.

But as soon I went to localhost:8080/applications/devices, the page turned out blank. I am guessing this was because the rpc method that I added, inside the grpc service, was not registered at /home/network-server/src/github.com/brocaar/lora-app-server/internal/api/external/external.go.
Am I debugging this right?

Open up the developer tools on your browser to debug it. Being it an addition to an existing service (which is already registered in the API), it probably has to do with some malformatted request or some bug at your endpoint logic. As said, check the frontend’s developer tools console and network tabs, as well as lora-app-server logs to find any issues.

1 Like

hi! Can you tell me if I can add a rpc method to return the gateway mac address inside deviceQueue.proto ??

Did you try something?

Yes, I did try something. I tried adding the following field “pid” in the existing api, instead of creating a new endpoint.

It was added successfully , but then I encountered the following errors the existing UI:

Whenever I clicked, on Applications > Device Name > Blank Page

Same is happening with organisation users and Gateways.

When I opened up the developers tools, I am getting the following errors:

Could you check the Network tab and paste here the actual requests including the request parameters? It seems like you have names mismatch between what the gRPC expects and what you’re sending parameter names wise.

I checked you were right, the parameters passed were incorrect.
Here is the screenshot that you asked for previously:

I changed in the file deviceQueue.proto , device_queue.go and DeviceQueueStore.js.
I did not touch the file DeviceStore.js. Therefore I am having difficulty debugging this;

Maybe you changed your device's proto definitions and thus it now expects devEui instead of dev_eui as a parameter.

On another note, screenshots aren’t very useful (for example, I can’t see what parameters were sent on the actual request). Prefer to show me the proto definitions, the store methods and the actual requests you see in the Network tab (not an image, just look the request uri and parameters for those failing and post them here).

That said, you mention that

1 Like

Hi, so I was trying to debug this, and I found out that maybe my logic in device_queue.go is incorrect. Since you can see that I added another field “pid” which gets the gateway id, can you tell me what kind of authentication and storage methods do i need to call?

I don’t know what’s the functionality you are implementing nor what you’re aiming for, so no, I don’t know what you need to do.

1 Like

Hi,
So I have been stuck here for a while now, and I really need someone to guide me.
So here is the brief summary of what I am trying to implement:

In localhost:8080/api , there is a service called DeviceQueueService. In it’s POST endpoint, I want to add the functionality of posting the GatewayID as well.
Currently, the user enters the devEUI, the data which he wants to send, and sends the downlink to that respective devEUI.
But I want the user to enter the GatewayID as well, with the devEUI, such that he could send the downlink data to that entered devEUI with the entered GatewayID.

So far, I have added string pid = 7 in the message DeviceQueueItem{} in the deviceQueue.proto file , and generated the swagger definitions, which were already being called by the DeviceQueueStore.js file, so when I built the code,

The added field reflected in the REST API. But now, I am getting the following error:

Maybe because I am not able to fetch the GatewayID from the loraserver database, in its respective device_queue.go. Maybe there is some error in this backend logic that I am not able to understand.
It would be great if you could help me with this.

What error? It seems you misquoted.

Do you mean you want the downlink to be sent using that particular gateway?

1 Like

Sorry I meant this, that I am encountering this error.

Yes! I want the downlink to be sent using that particular gateway to that particular device.

Also, I found out that the fault isn’t at the backend. The correct response is being received, and the response status is also 200, like below:

But, somehow the frontend is not able to load that response. So, the fault is at the React end. Can you please tell me how to solve this error?

As far as I could debug this error, this problem exists in fetching the AJAX Request.

As given on lora-app-server github repo :
The global fetch function allows to easily makes AJAX requests. It takes in a URL as an input and returns a Promise that resolves to a Response object. You can find more information about fetch here.

And currently the error is returning a “Uncaught (in promise) Error”.

Do you know how to solve this?

In all the images you link you’re showing details of a request that’s unrelated to the error you’re getting, so that’s not helpful. For example, the first image shows the details of the devices call, which is successful, and your error has to do with getting a single device, not listing them.

In any case, I told you long ago what was your problem regarding that:

The error is telling you exactly what’s the problem: devEui is expected but not given.

Then you’ll also need to start reading loraserver's and lora-gateway-bridge's code and see how it selects gateways for downlinks. You’re not making a trivial frontend change, you’re adding network level functionality, so you need to understand what the code does and how it does it if you’re gonna make any progress by yourself. I don’t remember exactly where that kind of stuff is located in each project, I switched jobs a month ago and am not longer working daily with the LoRaServer project, so you’ll need to look by yourself. I’ll be glad to help you with specifics or particular issues on the implementation, but I can’t do the whole work for you.

1 Like