StorageException in AzureFileSystem using Combinator

Feb 13, 2014 at 11:52 AM
Edited Feb 13, 2014 at 11:53 AM
We recently enabled Combinator on our development environment (Microsoft Azure) and for the most part, it's working great. However, on one page in particular it fails to combine the resources.
Through our logs and some inspection we have a vague idea where this is going wrong:

To start with, we get the following log:
Piedone.Combinator.CombinedResourceManager - Error when combining JavaScript files System.ArgumentException: File BingoGodz/Modules/Piedone/Combinator/Scripts/-39228965-2.js does not exist at
Orchard.Azure.Services.FileSystems.AzureFileSystem.GetPublicUrl(String path) in c:\BuildAgent4\work\6741e2b71683770c\src\Orchard.Web\Modules\Orchard.Azure\Services\FileSystems\AzureFileSystem.cs:line 299 at
Piedone.Combinator.Services.CacheFileService.<>c__DisplayClass4.<GetCombinedResources>b__3(AcquireContext`1 ctx) in c:\BuildAgent4\work\6741e2b71683770c\src\Orchard.Web\Modules\Piedone.Combinator\Services\CacheFileService.cs:line 133 at
Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in c:\BuildAgent4\work\6741e2b71683770c\src\Orchard\Caching\Cache.cs:line 57
Inspecting this location at the bottom on the stack trace (AzureFileSystem.GetPublicUrl(string path) : line 229) shows the following.
Container.EnsureBlobExists(String.Concat(_root, path));
EnsureBlobExists(this CloudBlobContainer container, string path) is defined as follows
public static void EnsureBlobExists(this CloudBlobContainer container, string path) {
    if (!BlobExists(container, path)) {
         throw new ArgumentException("File " + path + " does not exist");
So this shows where the exception is coming from. Following this, the only path in BlobExists(this CloudBlobContainer container, string path) that returns false is
catch (StorageException) {
    return false;
So at some point, we are throwing a StorageException whilst trying to determine whether the blob exists. So far I have been unable to find anywhere in the tree of the code prior to this catch statement that manually throws the exception so I believe it is something core to Windows Azure Storage.

For a bit of context this is always happening when we come from Piedone.Combinator.Services.CacheFileService.Save(int hashCode, CombinatorResource resource). We have passed over the block related to creating the file without any recorded indecent and the error comes as we try to write the combined resources to the file.
Specifically at line 103:
testResource.FillRequiredContext("TestCombinedResource", _storageProvider.GetPublicUrl(path));
So basically, a file has just been created and when we go to write to it, we throw an error saying the file is not there.

Any suggestions?
Feb 13, 2014 at 2:13 PM
Interesting. First of all make sure that you're using the latest version (the on in the Orchard 1.8 branch); this is only compatible with the to-be 1.8 Orchard version, i.e. the current 1.x one. The latest version contains some related fixes too (and I can verify that it generally works with Azure Blob storage too), I think I've seen this before.

If you're using Orchard 1.7.x then you can fairly easily back-port it by changing the root Web.config to be the same as in any other 1.7.x-compatible module.