anomalyco/sst · error · VisibleError

Function URL is not enabled. Enable it with "url: true".

Error message

Function URL is not enabled. Enable it with "url: true".

What it means

The Function's `url` getter returns the Lambda function URL only when the `url` option was enabled at deploy time. Accessing .url on a function without url: true unwraps an undefined endpoint and throws this VisibleError instead of returning a broken value.

Source

Thrown at platform/src/components/aws/function.ts:2972

      function: this.function,
      /**
       * The CloudWatch Log Group the function logs are stored.
       */
      logGroup: this.logGroup,
      /**
       * The Function Event Invoke Config resource if retries are configured.
       */
      eventInvokeConfig: this.eventInvokeConfig,
    };
  }

  /**
   * The Lambda function URL if `url` is enabled.
   */
  public get url() {
    return this.urlEndpoint.apply((url) => {
      if (!url) {
        throw new VisibleError(
          `Function URL is not enabled. Enable it with "url: true".`,
        );
      }
      return url;
    });
  }

  /**
   * The name of the Lambda function.
   */
  public get name() {
    return this.function.name;
  }

  /**
   * The ARN of the Lambda function.
   */
  public get arn() {

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Set url: true (or url: { authorizer: "iam" } etc.) on the Function args
  2. If the URL should be conditional, guard with the underlying output instead of accessing .url directly

Example fix

// before
const fn = new sst.aws.Function("Fn", {});
const endpoint = fn.url;
// after
const fn = new sst.aws.Function("Fn", { url: true });
const endpoint = fn.url;
Defensive patterns

Strategy: try-catch

Validate before calling

const url = fn.urlEndpoint;
// check the raw output before using .url
url.apply(u => { if (!u) console.warn("Function URL not enabled; set url: true"); });

Try / catch

try {
  const endpoint = fn.url;
  console.log(endpoint);
} catch (e) {
  if ((e as Error).message.includes("Function URL is not enabled")) {
    console.error("Set url: true on the Function");
  }
  throw e;
}

Prevention

When it happens

Trigger: Reading fn.url in sst.config.ts or in the output of a stack where the Function was created without url: true (or url: { ... } disabled); accessing url before/without a successful deploy.

Common situations: Linking a function and using its URL in an API route or frontend while forgetting to enable url; toggling url: false temporarily and downstream code still reading .url.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/e3b22af5543bda89. Report an issue: GitHub.