{"record":{"id":"472582fb17b459b7","repo":"gatsbyjs/gatsby","slug":"can-t-exclude-datastore-from-engine-function-witho","errorCode":null,"errorMessage":"Can't exclude datastore from engine function without adapter providing deployURL","messagePattern":"Can't exclude datastore from engine function without adapter providing deployURL","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/adapter/manager.ts","lineNumber":263,"sourceCode":"        },\n        reporter,\n        // Our internal Gatsby config allows this to be undefined but for the adapter we should always pass through the default values and correctly show this in the TypeScript types\n        trailingSlash: trailingSlash as TrailingSlash,\n        pathPrefix: pathPrefix as string,\n      }\n\n      await adapter.adapt(adaptContext)\n    },\n    config: async (): Promise<IAdapterFinalConfig> => {\n      let configFromAdapter: undefined | IAdapterConfig = undefined\n      if (adapter.config) {\n        configFromAdapter = await adapter.config({ reporter })\n\n        if (\n          configFromAdapter?.excludeDatastoreFromEngineFunction &&\n          !configFromAdapter?.deployURL\n        ) {\n          throw new Error(\n            `Can't exclude datastore from engine function without adapter providing deployURL`\n          )\n        }\n\n        if (configFromAdapter?.imageCDNUrlGeneratorModulePath) {\n          global.__GATSBY.imageCDNUrlGeneratorModulePath =\n            configFromAdapter.imageCDNUrlGeneratorModulePath\n        }\n\n        if (configFromAdapter?.fileCDNUrlGeneratorModulePath) {\n          global.__GATSBY.fileCDNUrlGeneratorModulePath =\n            configFromAdapter.fileCDNUrlGeneratorModulePath\n        }\n      }\n\n      return {\n        excludeDatastoreFromEngineFunction:\n          configFromAdapter?.excludeDatastoreFromEngineFunction ?? false,","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/adapter/manager.ts#L245-L281","documentation":"A Gatsby deployment adapter may exclude the datastore from the serverless engine function (to shrink bundle size), but only when it also provides a deployURL where the datastore can be fetched at runtime. Returning excludeDatastoreFromEngineFunction=true without a deployURL is contradictory and the manager throws.","triggerScenarios":"A custom adapter's config() returns { excludeDatastoreFromEngineFunction: true } but no deployURL string.","commonSituations":"Authoring/testing a custom Gatsby adapter (e.g. for a non-Gatsby-Cloud target); forking an adapter and removing the deployURL; misordered adapter config.","solutions":["Set deployURL alongside excludeDatastoreFromEngineFunction: true.","If you have no deployURL, set excludeDatastoreFromEngineFunction: false (or omit it).","Verify the adapter's config() returns both fields together when excluding the datastore."],"exampleFix":"// before\nasync config() {\n  return { excludeDatastoreFromEngineFunction: true }\n}\n// after\nasync config() {\n  return {\n    excludeDatastoreFromEngineFunction: true,\n    deployURL: process.env.DEPLOY_URL,\n  }\n}","handlingStrategy":"validation","validationCode":"function validateAdapterConfig(cfg) {\n  if (cfg?.excludeDatastoreFromEngineFunction && !cfg?.deployURL) {\n    throw new Error('excludeDatastoreFromEngineFunction requires deployURL')\n  }\n}","typeGuard":"function adapterConfigIsConsistent(cfg) {\n  return !cfg?.excludeDatastoreFromEngineFunction || Boolean(cfg?.deployURL)\n}","tryCatchPattern":null,"preventionTips":["Always pair excludeDatastoreFromEngineFunction with a concrete deployURL in adapter config().","Add an integration test that asserts the adapter returns both fields together.","Read deployURL from a guaranteed-present env var when excluding the datastore."],"tags":["adapter","deployment","config"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}