Skip to content

previewUrl silently fails when env var is unset or empty #37

@DeDuckProject

Description

@DeDuckProject

Problem

When app.previewUrl is set to an env var name (e.g. 'TEST_STORE_URL') and that variable is unset or empty in CI, the resolution falls back to the literal string 'TEST_STORE_URL'. This isn't a valid URL, so resolveBaseUrl returns null and the action fails with a generic error:

Error: No base URL available. Set app.previewUrl or app.startCommand + app.readyWhen in config.

This is confusing because the config does set app.previewUrl — the user has no idea the env var lookup silently failed.

Expected behaviour

If app.previewUrl is set to a string that looks like an env var name (no protocol) and process.env[value] is undefined or empty, the action should fail fast with a clear, actionable message:

Error: app.previewUrl is set to 'TEST_STORE_URL' but process.env.TEST_STORE_URL is not defined.
Make sure the variable is passed to the git-glimpse workflow step via env:.

Suggested fix

In resolveBaseUrl, after resolving the env var, check whether the result is a valid URL before returning it. If not, throw (or log + return null) with the specific variable name called out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions