{"record":{"id":"6a98f07a4133a2ed","repo":"TryGhost/Ghost","slug":"baseurl-is-not-defined","errorCode":null,"errorMessage":"baseURL is not defined","messagePattern":"baseURL is not defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"e2e/helpers/playwright/fixture.ts","lineNumber":543,"sourceCode":"        if (!stripeEnabled || !baseURL || !stripeServer) {\n            await use(undefined);\n            return;\n        }\n\n        const webhookClient = new WebhookClient(baseURL);\n        const service = new StripeTestService(stripeServer, webhookClient);\n        await use(service);\n    },\n\n    baseURL: async ({ghostInstance, _testEnvironmentContext}, use) => {\n        _testEnvironmentContext.markResetEnvironmentBlocker('baseURL');\n        await use(ghostInstance.baseUrl);\n    },\n\n    // Create user credentials only (no authentication)\n    ghostAccountOwner: async ({ghostInstance, _testEnvironmentContext}, use) => {\n        if (!ghostInstance.baseUrl) {\n            throw new Error('baseURL is not defined');\n        }\n\n        _testEnvironmentContext.markResetEnvironmentBlocker('ghostAccountOwner');\n\n        if (_testEnvironmentContext.resolvedIsolation === 'per-file' && cachedPerFileGhostAccountOwner) {\n            await use(cachedPerFileGhostAccountOwner);\n            return;\n        }\n\n        // Create user in this Ghost instance\n        const ghostAccountOwner: User = {\n            name: 'Test User',\n            email: `test${faker.string.uuid()}@ghost.org`,\n            password: 'test@123@test'\n        };\n        await setupUser(ghostInstance.baseUrl, ghostAccountOwner);\n\n        if (_testEnvironmentContext.resolvedIsolation === 'per-file') {","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/e2e/helpers/playwright/fixture.ts#L525-L561","documentation":"The ghostAccountOwner fixture asserts ghostInstance.baseUrl is truthy before creating the test owner. A falsy baseUrl means the Ghost instance fixture didn't produce a URL — setup didn't run, failed, or the instance is in a state where no gateway URL was assigned. This guard fails fast rather than passing undefined into User creation/API calls.","triggerScenarios":"ghostInstance fixture resolved but baseUrl is empty (instance not started, gateway port not assigned). Fixture ordering pulled ghostAccountOwner without ghostInstance completing properly. Instance creation returned an object lacking baseUrl.","commonSituations":"Setup failed silently and returned a partial instance; gateway never came up so baseUrl wasn't set; fixture misconfiguration where ghostAccountOwner is requested without the ghost instance being ready.","solutions":["Ensure the ghostInstance fixture fully completes (container + gateway ready) before ghostAccountOwner is used — check waitForReady ran.","Log ghostInstance in the fixture to see what baseUrl (and the rest) actually resolved to.","Make instance setup throw (rather than return a baseUrl-less object) so the real failure surfaces earlier.","Confirm the gateway port assignment path (getGatewayPort) ran during setup."],"exampleFix":"// before\nif (!ghostInstance.baseUrl) {\n    throw new Error('baseURL is not defined');\n}\n\n// after\nif (!ghostInstance.baseUrl) {\n    throw new Error(`baseURL is not defined (instance state: ${JSON.stringify({running: !!ghostInstance.container, port: ghostInstance.port})})`);\n}","handlingStrategy":"validation","validationCode":"if (!ghostInstance.baseUrl) {\n    throw new Error(`ghostInstance.baseUrl missing (setup incomplete: ${JSON.stringify({container: !!ghostInstance.container})})`);\n}","typeGuard":"function instanceHasBaseUrl(i: GhostInstance): i is GhostInstance & {baseUrl: string} {\n    return typeof i.baseUrl === 'string' && i.baseUrl.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Ensure ghostInstance setup fully completes (gateway port assigned) before dependent fixtures run.","Make instance setup throw rather than return a baseUrl-less object.","Log ghostInstance state in the fixture when baseUrl is missing to find the upstream cause."],"tags":["e2e","fixture","lifecycle","baseurl","precondition"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}