Open Closed

FileDescriptor Download Endpoint 401 unauthorized exception on ECS #6405


User avatar
0
selinkoykiran created

Hello , We have a dockerized served over aws ecs environment. Normally on local there is nothing wrong, it works successfully , but when we try on ecs environment below responses coming from file management download endpoint : the first request which takes the token , seems successfull , (By the way it says succesfull but the response seems empty over google inspect window ):

After that, second request to download with this (unseen over google inspect window) token ends like below:

Like I said we couldn't reproduce the same error on our local , why this token could not be authorized ? Can you help? Thanks.

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.3.1
  • UI Type: Angular / MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ABP uses distributed cache to store the download token.

    Is the Redis server available?

  • User Avatar
    0
    selinkoykiran created

    Hello , Thank you for that information Yes it is already enabled. What could be the problem then ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    We have a dockerized served over aws ecs environment.

    I think it must be related to the cache, different instances may use different Redis in the docker container.

  • User Avatar
    0
    selinkoykiran created

    But in that case sometimes we should be able to download , sometimes not , right ? In our case we couldn't download even once. How should we check that if we have one redis ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    How should we check that if we have one redis ?

    You can use the distributed cache to set some test data and read it:

    public class TestCacheItem
    {
        public string Value { get; set; }
    }
    
    public class TestCacheAppService : ApplicationService, ITestCacheAppService
    {
        private readonly IDistributedCache<TestCacheItem> _cache;
    
        public TestCacheAppService(IDistributedCache<TestCacheItem> cache)
        {
            _cache = cache;
        }
    
        public Task SetCacheAsync(string key, string value)
        {
            _cache.Set(key, new TestCacheItem { Value = value }, new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5)
            });
            return Task.CompletedTask;
        }
        
        public async Task<string?> GetCacheAsync(string key)
        {
            var item = await _cache.GetAsync(key);
            return item?.Value;
        }
    }
    

    Is your Redis server running in a docker container or you are using Amazon ElastiCache for Redis Could you please share the dockerfile or docker-compose file and application log file? thanks

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11