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

Relative URI exception in Azure Production #198

Open
skwiggly opened this issue Jul 20, 2021 · 0 comments
Open

Relative URI exception in Azure Production #198

skwiggly opened this issue Jul 20, 2021 · 0 comments

Comments

@skwiggly
Copy link

Our team recently upgraded from Umbraco 7.15.6 to 8.11, running in Azure. We are using Client Dependency v1.9.9. In our Test and Staging environments, CDF works fine, no errors. However in Production, we have been getting dozens of exceptions daily like:

Could not load file contents from /css/bootstrap/css/bootstrap.min.css. EXCEPTION: This operation is not supported for a relative URI.

Exception
System.InvalidOperationException: This operation is not supported for a relative URI.
   at System.Uri.get_AbsolutePath()
   at ClientDependency.Core.CompositeFiles.Providers.BaseCompositeFileProcessingProvider.WritePathToStream(ClientDependencyType type, String path, HttpContextBase context, StreamWriter sw) in C:\Users\Shannon\Documents\_Projects\ClientDependency\ClientDependency\src\ClientDependency.Core\CompositeFiles\Providers\BaseCompositeFileProcessingProvider.cs:line 218

The exceptions are for a variety of CSS and JS files, which are are local files, in the "umbraco_assets" folder. Based on timestamps, it appears that only one or a few files throw an exception at a time, not all of them.

This seems to be similar to this issue: #147
Except we are not using any custom file writers, and no custom file types. We have registered .js and .css as follows:
fileDependencyExtensions=".js,.css"

This is an example of how we create our bundles:

BundleManager.CreateCssBundle("ConsumerStylesResponsive",
                new CssFile("~/umbraco_assets/css/bootstrap/css/bootstrap.min.css"),
                new CssFile("~/umbraco_assets/css/v5/consumer_styles_new.css"));

This is the related portion of clientDependency.config:

<compositeFiles defaultProvider="defaultFileProcessingProvider" compositeFileHandlerPath="~/umbraco_assets/DependencyHandler.axd">
    <fileProcessingProviders>
      <add name="CompositeFileProcessor" type="ClientDependency.Core.CompositeFiles.Providers.CompositeFileProcessingProvider, ClientDependency.Core" enableCssMinify="true" enableJsMinify="true" persistFiles="true" compositeFilePath="~/App_Data/ClientDependency" bundleDomains="localhost:123456" urlType="Base64QueryStrings" pathUrlFormat="{dependencyId}/{version}/{type}" />
    </fileProcessingProviders>
    <!-- A file map provider stores references to dependency files by an id to be used in the handler URL when using the MappedId Url type -->
    <fileMapProviders>
      <add name="XmlFileMap" type="ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper, ClientDependency.Core" mapPath="~/App_Data/ClientDependency" />
    </fileMapProviders>
  </compositeFiles>

The only notable thing about the clientDependency.config is that initially, we had this setting:
compositeFileHandlerPath="~/DependencyHandler.axd"
However, again only in Production, DependencyHandler.axd was throwing a 404 and not loading ANY CSS/JS. Only when we changed it to:
compositeFileHandlerPath="~/umbraco_assets/DependencyHandler.axd"
Did CDF start working again.

How can we debug what is happening here? I don't have steps to reproduce since everything works when running localhost, Test and Staging; this is only happening in our Production Azure environment, and I have never personally experienced the Prod site not loading CSS/JS.

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

1 participant