{"record":{"id":"16cab1642c5be352","repo":"serverless/serverless","slug":"function-not-yet-deployed","errorCode":"FUNCTION_NOT_YET_DEPLOYED","errorMessage":"The function \"${this.options.function}\" you want to update is not yet deployed. Please run \"serverless deploy\" to deploy your service. After that you can redeploy your services functions with the \"serverless deploy function\" command.","messagePattern":"The function \"(.+?)\" you want to update is not yet deployed\\. Please run \"serverless deploy\" to deploy your service\\. After that you can redeploy your services functions with the \"serverless deploy function\" command\\.","errorType":"error_code","errorClass":"ServerlessError","httpStatus":null,"severity":"error","filePath":"packages/serverless/lib/plugins/aws/deploy-function.js","lineNumber":99,"sourceCode":"    // check if function exists on AWS\n    const params = {\n      FunctionName: this.options.functionObj.name,\n    }\n\n    const result = await (async () => {\n      try {\n        return await this.provider.request('Lambda', 'getFunction', params)\n      } catch (error) {\n        if (\n          _.get(error, 'providerError.code') === 'ResourceNotFoundException'\n        ) {\n          const errorMessage = [\n            `The function \"${this.options.function}\" you want to update is not yet deployed.`,\n            ' Please run \"serverless deploy\" to deploy your service.',\n            ' After that you can redeploy your services functions with the',\n            ' \"serverless deploy function\" command.',\n          ].join('')\n          throw new ServerlessError(errorMessage, 'FUNCTION_NOT_YET_DEPLOYED')\n        }\n        throw error\n      }\n    })()\n\n    if (result) this.serverless.service.provider.remoteFunctionData = result\n  }\n\n  checkIfFunctionChangesBetweenImageAndHandler() {\n    const functionObject = this.serverless.service.getFunction(\n      this.options.function,\n    )\n    const remoteFunctionPackageType =\n      this.serverless.service.provider.remoteFunctionData.Configuration\n        .PackageType\n\n    if (functionObject.handler && remoteFunctionPackageType === 'Image') {\n      throw new ServerlessError(","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/serverless/lib/plugins/aws/deploy-function.js#L81-L117","documentation":"In deploy-function.js, the fetchFunctionData step calls Lambda GetFunction for the target function. If AWS returns ResourceNotFoundException (providerError.code), the framework throws FUNCTION_NOT_YET_DEPLOYED: the deploy function command only updates an already-deployed function, so a missing one means the full service was never deployed.","triggerScenarios":"Running `serverless deploy function -f <name>` before `serverless deploy` has ever been run for the stack; the function was removed from AWS but is still in serverless.yml; wrong stage/region/profile points at a stack that has no such function.","commonSituations":"New function added to serverless.yml and deployed via deploy function without a full deploy first; switched AWS profile or stage; stack was manually deleted; typo in the function name passed to -f.","solutions":["Run `serverless deploy` once to create the stack and all its functions, then use `serverless deploy function -f <name>` for fast updates.","Verify the -f value matches a function key in serverless.yml.","Confirm the stage, region, and AWS profile match the stack you intend to update."],"exampleFix":"# before: deploy a single function on a fresh stack\nserverless deploy function -f myFunc\n# after\nserverless deploy                  # creates the stack + all functions\nserverless deploy function -f myFunc   # now safe for fast updates","handlingStrategy":"try-catch","validationCode":"async function functionExists(provider, name) {\n  try {\n    await provider.request('Lambda', 'getFunction', { FunctionName: name });\n    return true;\n  } catch (e) {\n    return _.get(e, 'providerError.code') !== 'ResourceNotFoundException';\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await deployFunction();\n} catch (e) {\n  if (e.code === 'FUNCTION_NOT_YET_DEPLOYED') {\n    console.error('Run `serverless deploy` first to create the stack.');\n  }\n  throw e;\n}","preventionTips":["Run `serverless deploy` once per new stack before using deploy function.","Verify the function name, stage, region, and AWS profile before update.","In CI, gate deploy function behind a check that the stack exists."],"tags":["aws","deploy","lambda","function-deploy"],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}