{"record":{"id":"3a7811fef8adc97b","repo":"elsa-workflows/elsa-core","slug":"there-was-no-base-url-configured-which-means-no-absolute-url","errorCode":null,"errorMessage":"There was no base URL configured, which means no absolute URL can be generated from outside the context of an HTTP request. Please make sure that `HttpActivityOptions` is configured correctly. The configuration key used in most Elsa samples is usually: \"Elsa:Server:BaseUrl\"","messagePattern":"There was no base URL configured, which means no absolute URL can be generated from outside the context of an HTTP request\\. Please make sure that `HttpActivityOptions` is configured correctly\\. The configuration key used in most Elsa samples is usually: \"Elsa:Server:BaseUrl\"","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/modules/Elsa.Http/Services/DefaultAbsoluteUrlProvider.cs","lineNumber":22,"sourceCode":"namespace Elsa.Http.Services;\n\n/// <inheritdoc />\npublic class DefaultAbsoluteUrlProvider : IAbsoluteUrlProvider\n{\n    private readonly IOptions<HttpActivityOptions> _options;\n    \n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"DefaultAbsoluteUrlProvider\"/> class.\n    /// </summary>\n    public DefaultAbsoluteUrlProvider(IOptions<HttpActivityOptions> options) => _options = options;\n\n    /// <inheritdoc />\n    public Uri ToAbsoluteUrl(string relativePath)\n    {\n        var baseUrl = _options.Value.BaseUrl;\n\n        if (baseUrl == null)\n            throw new Exception(\n                \"There was no base URL configured, which means no absolute URL can be generated from outside the context of an HTTP request. Please make sure that `HttpActivityOptions` is configured correctly. The configuration key used in most Elsa samples is usually: \\\"Elsa:Server:BaseUrl\\\"\");\n\n        // To not lose any base path information, we need to ensure that:\n        // - Base path ends with a slash.\n        // - Relative path does NOT start with a slash.\n        var baseUri = new Uri(baseUrl.ToString().TrimEnd('/') + '/');\n        relativePath = relativePath.TrimStart('/');\n\n        return new Uri(baseUri, relativePath);\n    }\n}","sourceCodeStart":4,"sourceCodeEnd":33,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Http/Services/DefaultAbsoluteUrlProvider.cs#L4-L33","documentation":"DefaultAbsoluteUrlProvider.ToAbsoluteUrl builds absolute URLs for HTTP callbacks and webhook responses. It requires HttpActivityOptions.BaseUrl to be configured; when running outside an active HTTP request there is no ambient request to infer a base from, so it throws when BaseUrl is null.","triggerScenarios":"Calling ToAbsoluteUrl(relativePath) (directly or via HttpEndpoint signal/callback URL generation) while HttpActivityOptions.BaseUrl was never set in DI configuration, e.g. missing the Elsa:Server:BaseUrl config key.","commonSituations":"Self-hosted console apps or background/workflow-server hosts that never call UseBaseUrl; missing appsettings.json section in a deployed environment; Docker/K8s image deployed without the Server:BaseUrl environment variable.","solutions":["Configure the base URL: services.Configure<HttpActivityOptions>(o => o.BaseUrl = new Uri(\"https://myhost/\")) or add \"Elsa\": { \"Server\": { \"BaseUrl\": \"https://myhost\" } } to configuration","Verify the environment actually provides the config key (env var Elsa__Server__BaseUrl in containers)","In tests, set HttpActivityOptions.BaseUrl explicitly (e.g. http://localhost) in the test fixture","Wrap callback-URL generation behind a check so it only runs when a base URL is configured"],"exampleFix":"// before\nservices.AddHttpActivities(); // no BaseUrl configured\n// after\nservices.AddHttpActivities(http => http.BaseUrl = new Uri(configuration[\"Elsa:Server:BaseUrl\"]!));","handlingStrategy":"validation","validationCode":"var baseUrl = httpClientFactory /* or config */ ...;\nif (Uri.TryCreate(config[\"Elsa:Server:BaseUrl\"], UriKind.Absolute, out var uri))\n    services.Configure<HttpActivityOptions>(o => o.BaseUrl = uri);\nelse\n    throw new InvalidOperationException(\"HttpActivityOptions.BaseUrl is not configured\");","typeGuard":null,"tryCatchPattern":"try { url = absoluteUrlProvider.ToAbsoluteUrl(path); }\ncatch (Exception ex) when (ex.Message.Contains(\"no base URL configured\"))\n{\n    logger.LogError(ex, \"HttpActivityOptions.BaseUrl is missing; configure Elsa:Server:BaseUrl\");\n    throw;\n}","preventionTips":["Set Elsa:Server:BaseUrl (or Elsa__Server__BaseUrl in env vars) in every deployment environment","Add a startup validation step that fails fast when HttpActivityOptions.BaseUrl is null","In tests, configure a base URL like http://localhost in the shared fixture"],"tags":["http","configuration","elsa","base-url"],"backgroundTag":"missing-required-config-field","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}