Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

>_ Device Command, request size limits? #3824

Open
alexcorvis84 opened this issue Jul 20, 2023 · 8 comments
Open

>_ Device Command, request size limits? #3824

alexcorvis84 opened this issue Jul 20, 2023 · 8 comments

Comments

@alexcorvis84
Copy link

I'd like to know what is the request size limit for Kapua, if it can be increased and how it could be done.

I'm trying to send a Kura update (zip file containing the update shell script file) for a Device through the Device >_ Command service, but I'm gettng the following error:

imagen

Update file is in base64 passed in body parameter for the request of Device Management - Command:

imagen

imagen

Is there any other way or request to send and update through Kapua?

Regards.

@Agnul97
Copy link
Contributor

Agnul97 commented Aug 7, 2023

Hi @alexcorvis84 . Can you link me the kura update you are trying to send? I'll try to reproduce the problem and find a solution

@Agnul97
Copy link
Contributor

Agnul97 commented Aug 30, 2023

@alexcorvis84 Technically the underlying Jetty on Kapua does not impose a limitation on the body of the sent JSON but I suppose some other layer is limiting the sending, and that could be even the client you are using to perform the API request. Also, from what I understand, you are trying to send a zip file that is ~70 MB in size, which is quite big so is reasonable that some layer is trying to block you (for example, in a logic to prevent DOS attacks on the server). I suggest to do in this way in order to perform the same thing:

  1. Upload the base64 encoded zip file on some external web server
  2. Create a script that retrieves that zip file with HTML or FTP
  3. Send this script with the API end-point you are using, via the "body" parameter. In this way it will be executed and will retrieve the zip file you want to have on the device

@alexcorvis84
Copy link
Author

alexcorvis84 commented Aug 31, 2023

Hi @alexcorvis84 . Can you link me the kura update you are trying to send? I'll try to reproduce the problem and find a solution

Hi @Agnul97, sure, you can find the update in the next LINK.

FYI:

The script (which updates a RaspberryPi device running Kura 5.2.0 to 5.3.0) has been created and based on the kura-upgrade-process scripts that was listed in this page (seem it was deleted on 4 July 2023 😦 Update: I've been able to find an snapshot on internet archive).

Anyway, I was able to create the update script based on original scripts as I commented in this issue.

It has been tested locally and checked it works OK.

So, I was trying to send it through Kapua with the Device >_ Command service without success.

Finally, I've been able to send it via Kapua REST API - Device Management - Package download endpoint

imagen

@alexcorvis84
Copy link
Author

@alexcorvis84 Technically the underlying Jetty on Kapua does not impose a limitation on the body of the sent JSON but I suppose some other layer is limiting the sending, and that could be even the client you are using to perform the API request. Also, from what I understand, you are trying to send a zip file that is ~70 MB in size, which is quite big so is reasonable that some layer is trying to block you (for example, in a logic to prevent DOS attacks on the server). I suggest to do in this way in order to perform the same thing:

1. Upload the base64 encoded zip file on some external web server

2. Create a script that retrieves that zip file with HTML or FTP

3. Send this script with the API end-point you are using, via the "body" parameter. In this way it will be executed and will retrieve the zip file you want to have on the device

Yeah, I think error was related due proxy/firewall limitations.

As I commented above post, finally I was able to send the update via REST API 😄

Thanks for your support.

@Agnul97
Copy link
Contributor

Agnul97 commented Aug 31, 2023

@alexcorvis84 Technically the underlying Jetty on Kapua does not impose a limitation on the body of the sent JSON but I suppose some other layer is limiting the sending, and that could be even the client you are using to perform the API request. Also, from what I understand, you are trying to send a zip file that is ~70 MB in size, which is quite big so is reasonable that some layer is trying to block you (for example, in a logic to prevent DOS attacks on the server). I suggest to do in this way in order to perform the same thing:

1. Upload the base64 encoded zip file on some external web server

2. Create a script that retrieves that zip file with HTML or FTP

3. Send this script with the API end-point you are using, via the "body" parameter. In this way it will be executed and will retrieve the zip file you want to have on the device

Yeah, I think error was related due proxy/firewall limitations.

As I commented above post, finally I was able to send the update via REST API 😄

Thanks for your support.

In any case, this issue you opened could have exposed a problem with the underlying Kapua limitations regarding the dimensions of POST body requests, considering that it seems that other layers external to the application blocked the sent payload. Could you give me the environment you used to deploy kapua? Were you using Kapua locally or in some deployment with other proxy/firewalls?

I tried to emulate locally what you were trying to do with a large zip file but, for example, using CURL I get limitations on the CURL command for the size of the fields (the base 64encoded zip file too large)

@alexcorvis84
Copy link
Author

@alexcorvis84 Technically the underlying Jetty on Kapua does not impose a limitation on the body of the sent JSON but I suppose some other layer is limiting the sending, and that could be even the client you are using to perform the API request. Also, from what I understand, you are trying to send a zip file that is ~70 MB in size, which is quite big so is reasonable that some layer is trying to block you (for example, in a logic to prevent DOS attacks on the server). I suggest to do in this way in order to perform the same thing:

1. Upload the base64 encoded zip file on some external web server

2. Create a script that retrieves that zip file with HTML or FTP

3. Send this script with the API end-point you are using, via the "body" parameter. In this way it will be executed and will retrieve the zip file you want to have on the device

Yeah, I think error was related due proxy/firewall limitations.
As I commented above post, finally I was able to send the update via REST API 😄
Thanks for your support.

In any case, this issue you opened could have exposed a problem with the underlying Kapua limitations regarding the dimensions of POST body requests, considering that it seems that other layers external to the application blocked the sent payload. Could you give me the environment you used to deploy kapua? Were you using Kapua locally or in some deployment with other proxy/firewalls?

I tried to emulate locally what you were trying to do with a large zip file but, for example, using CURL I get limitations on the CURL command for the size of the fields (the base 64encoded zip file too large)

Hi @Agnul97,

We've deployed Kapua in a local server on a docker 🐳 swarm with other proxy/firewalls.

@Agnul97
Copy link
Contributor

Agnul97 commented Aug 31, 2023

@alexcorvis84 Technically the underlying Jetty on Kapua does not impose a limitation on the body of the sent JSON but I suppose some other layer is limiting the sending, and that could be even the client you are using to perform the API request. Also, from what I understand, you are trying to send a zip file that is ~70 MB in size, which is quite big so is reasonable that some layer is trying to block you (for example, in a logic to prevent DOS attacks on the server). I suggest to do in this way in order to perform the same thing:

1. Upload the base64 encoded zip file on some external web server

2. Create a script that retrieves that zip file with HTML or FTP

3. Send this script with the API end-point you are using, via the "body" parameter. In this way it will be executed and will retrieve the zip file you want to have on the device

Yeah, I think error was related due proxy/firewall limitations.
As I commented above post, finally I was able to send the update via REST API 😄
Thanks for your support.

In any case, this issue you opened could have exposed a problem with the underlying Kapua limitations regarding the dimensions of POST body requests, considering that it seems that other layers external to the application blocked the sent payload. Could you give me the environment you used to deploy kapua? Were you using Kapua locally or in some deployment with other proxy/firewalls?
I tried to emulate locally what you were trying to do with a large zip file but, for example, using CURL I get limitations on the CURL command for the size of the fields (the base 64encoded zip file too large)

Hi @Agnul97,

We've deployed Kapua in a local server on a docker 🐳 swarm with other proxy/firewalls.

What kind of client you used to perform the API call? I tried both swaggerUI and Curl and there were limitations on the input buffer in the insertio of the so-damn-large zip file :)

@alexcorvis84
Copy link
Author

What kind of client you used to perform the API call? I tried both swaggerUI and Curl and there were limitations on the input buffer in the insertio of the so-damn-large zip file :)

First I tried with cURL and then I used Postman!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants