Open Closed

BlobContainer cannot find the file. #5562


User avatar
0
yunusemrecaglar created
  • ABP Framework version: v7.2.2
  • UI type: Blazor Server
  • DB provider: EF Core
  • Tiered (MVC) or Auth Server Separated (Angular): yes

Hi, I'm trying to retrieve a file from the blob table using _blobContainer, just like in the screenshot. Even though the Name and ContainerId values are correct, it's returning a byte[0] value. There are 150 files like this in the blob table, but only this particular file is giving an error like this. What could be the reason for this?


9 Answer(s)
  • User Avatar
    0
    jfistelmann created

    Can you please share the complete executing line 3559?

    are you parsing the blobId to a string? if yes, please to that in a separate line and carefully compare the output to the expected name.

    As you can see here: https://github.com/abpframework/abp/blob/2ab863186791f91edc6ff1f8d520a4979c67d2be/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainerExtensions.cs#L40

    it may return null if the names do not match.

    To speed things up, you can try to not use the GetOrNull, but Get instead and see where it fails. GetOrNull may return null in a lot of cases, which makes issue tracking somewhat difficult.

  • User Avatar
    0
    yunusemrecaglar created
  • User Avatar
    0
    jfistelmann created

    Have you checked the points I described?

  • User Avatar
    0
    yunusemrecaglar created

    Yes, I've checked. I used GetOrNull, but the file still didn't come

  • User Avatar
    0
    jfistelmann created

    Yes, I've checked. I used GetOrNull, but the file still didn't come

    Please try something without ...OrNull because those calls handle errors.

    something like this:

    var blobName = blobId.ToString();
    var result = await _blobContainer.GetAsync(name: blobName);
    return result;
    

    then you should be able to see where things go wrong.

  • User Avatar
    0
    yunusemrecaglar created

    ! image.png

    Data still didn't come.

  • User Avatar
    0
    jfistelmann created

    Data not coming was expected. I was hoping for an exception though. So, if I interpret this correctly:

    Your blob name is correct, else it could not get it. But for some reason the stream is not returning any useful data. Must have something gone wrong with the upload I think. If this is a one-time-issue, is re-uploading a possible solution for you?

    If so, maybe add some validation code that after an upload you try to get the stream -> if it's null like in this specific case, throw an exception to communicate that something has gone wrong

  • User Avatar
    0
    yunusemrecaglar created

    I couldn't find the solution. Can we retrieve the ticket?

  • User Avatar
    0
    jfistelmann created

    Sure, I'll close and refund.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15