Asset upload size config - Docker

@Sebastian , good evening!

I have a question, like changing the file size limit to upload in docker.

Good morning. What is your question? :wink:

In general you can overwrite all app settings (https://github.com/Squidex/squidex/blob/master/src/Squidex/appsettings.json) in Docker with environment variables.

All settings get converted to a map of key and value, where the key is the full path to the value.

e.g.

assets:maxSize=123

if you want to override this you just have to use double underscore in your environment variable instead of colon:

ASSETS__MAXSIZE=123

Good Morning,
After you make the change, do I need to do anything else?

Restart of course. What is the problem?

Restart the container or composer?

On this question, I found the answer, just run the following code …

docker-compose up --detach --build

I changed the folder amazenametos to the Azure Blob - ok

ASSETSTORE__TYPE=AzureBlob
ASSETSTORE__AZUREBLOB__CONNECTIONSTRING=…

I’ve alter the upload to

  - ASSETS__MAXSIZE=104857600

But even alerting the size of the upload, I still get the message …

png

png

Being that the file that I am uploading has 3.78 MB, which in theory is still within the standard size that is 5 MB

png

This is an nginx error. I will have a look what you have to configure there and ensure that the setup process is smoother.

The default docker config uses nginx with some default settings and the default option for nginx is 1MB upload size.

You can change it with client_max_body_size 1g for example.

I created an own dockerfile for the proxy where I overwrite a settings: https://github.com/Squidex/squidex-docker/blob/master/standalone/proxy/Dockerfile

You could do the same and overwrite this setting. It would be great if we could make this dockerfile configurable with environment variable and then using a single variable in the .env file to overwrite the setting from nginx and Squidex.

Some help would be very welcome :slight_smile:

1 Like

Even with all the changes above, I am unable to upload files beyond 1MB. I added it to the docker-compose and the nginx my_proxy.conf but no luck so far.

The error is still “Asset is too big”

It is very likely that you have done something wrong then. It has been asked a few days ago as well if I remember correctly.

See: Asset is too big. error

I am using the nginx-proxy. I could even get it to work via the Dashboard, but uploads via the .NET SDK still fail.

That’s weird, it is the same endpoint. What exception do you get in the SDK?

Asset exceeds the maximum size.
Status: 400

The 400 error message is bad, it comes from the generated code. It means that you have exceeded the included storage contingent in the cloud.

Usually you get a 413 for too big assets.

Its the self-hosted version

Yes, I understand that. Do you get a error dto in your object? It is a message showing the details.

Which version do you use? Can you show me your code?

Client Version: 5.5

Code:

    private IAssetsClient _assetClient => _clientManager.CreateAssetsClient();
    private AssetDto CreateAndUploadAsset(Stream content, Guid? parentId)
    {
        return AsyncHelper.RunSync(() => _assetClient.PostAssetAsync("xxx", content, parentId));
    }

    public AssetDto CreateAndUploadPartnerAsset(Stream content)
    {
        return CreateAndUploadAsset(content, Guid.Parse("d607288f-f993-4d09-b961-be2bd7a1b22c"));
    }

Exception Message:
Asset exceeds the maximum size.
Status: 400
Response:

Stacktrace:

   at Squidex.ClientLibrary.Management.AssetsClient.<PostAssetAsync>d__21.MoveNext()

— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at xxxx.Common.AsyncHelper.RunSync[TResult](Func1 func) in C:\Projects\xxxx\AsyncHelper.cs:line 17
at xxxx.Models.Logic.SquidexCmsLogic.CreateAndUploadAsset(Stream content, Nullable`1 parentId) in C:\Projects\xxxx\Logic\Impl\SquidexCmsLogic.cs:line 142
at xxxx.Logic.SquidexCmsLogic.CreateAndUploadPartnerAsset(Stream content) in C:\Projects\xxxx\Logic\Impl\SquidexCmsLogic.cs:line 147
at SolverAndScoreAppointmentPlanningTester.Program.Main(String[] args) in C:\Projects\xxxx\SolverAndScoreAppointmentPlanningTester\Program.cs:line 295

I think your problem has nothing to do with the asset size.

The problem on my side is the descriptions that are generated by the SDK. At the beginning I made them very specific and then more and more error cases were introduced and the specific messages do not match anymore.

What kind of exception do you? if you get a SquidexManagementException you should get the details from the error dto using the debugger.