serverless/serverless · error · ServerlessError

FUNCTION_NOT_YET_DEPLOYED

FUNCTION_NOT_YET_DEPLOYED

Error message

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.

What it means

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.

Source

Thrown at packages/serverless/lib/plugins/aws/deploy-function.js:99

    // check if function exists on AWS
    const params = {
      FunctionName: this.options.functionObj.name,
    }

    const result = await (async () => {
      try {
        return await this.provider.request('Lambda', 'getFunction', params)
      } catch (error) {
        if (
          _.get(error, 'providerError.code') === 'ResourceNotFoundException'
        ) {
          const 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.',
          ].join('')
          throw new ServerlessError(errorMessage, 'FUNCTION_NOT_YET_DEPLOYED')
        }
        throw error
      }
    })()

    if (result) this.serverless.service.provider.remoteFunctionData = result
  }

  checkIfFunctionChangesBetweenImageAndHandler() {
    const functionObject = this.serverless.service.getFunction(
      this.options.function,
    )
    const remoteFunctionPackageType =
      this.serverless.service.provider.remoteFunctionData.Configuration
        .PackageType

    if (functionObject.handler && remoteFunctionPackageType === 'Image') {
      throw new ServerlessError(

View on GitHub (pinned to b9d7ea51c8)

Solutions

  1. Run `serverless deploy` once to create the stack and all its functions, then use `serverless deploy function -f <name>` for fast updates.
  2. Verify the -f value matches a function key in serverless.yml.
  3. Confirm the stage, region, and AWS profile match the stack you intend to update.

Example fix

# before: deploy a single function on a fresh stack
serverless deploy function -f myFunc
# after
serverless deploy                  # creates the stack + all functions
serverless deploy function -f myFunc   # now safe for fast updates
Defensive patterns

Strategy: try-catch

Validate before calling

async function functionExists(provider, name) {
  try {
    await provider.request('Lambda', 'getFunction', { FunctionName: name });
    return true;
  } catch (e) {
    return _.get(e, 'providerError.code') !== 'ResourceNotFoundException';
  }
}

Try / catch

try {
  await deployFunction();
} catch (e) {
  if (e.code === 'FUNCTION_NOT_YET_DEPLOYED') {
    console.error('Run `serverless deploy` first to create the stack.');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of serverless/serverless@b9d7ea51c8 (2026-08-13). Data as JSON: /api/errors/16cab1642c5be352. Report an issue: GitHub.