Ari Waisberg
Ari Waisberg

Reputation: 1303

AWS CodeBuild SAM esbuild method not working

I have a Lambda's API Gateway repo in CodeCommit and I build it with CLI with esbuild and it works fine (SAM BUILD and then SAM DEPLOY)

I want to integrate the building process with CodePipeline, so started to play around with CodeBuild, but when I run the build it says:

File "/root/.pyenv/versions/3.9.5/lib/python3.9/site-packages/samcli/lib/build/workflow_config.py", line 133, in get_selector raise UnsupportedBuilderException("'{}' does not have a supported builder".format(specified_workflow)) samcli.lib.build.workflow_config.UnsupportedBuilderException: 'esbuild' does not have a supported builder

My template Lambda looks like this: (I remove the properties in order to make it easier to read)

BasicFunction:
    Type: AWS::Serverless::Function
    Properties:
    Metadata:
      BuildMethod: esbuild
      BuildProperties:
        Minify: false
        Target: "es2020"
        EntryPoints:
        - appBasic.ts

My buildspec.yml looks like this:

version: 0.2
phases:
  install:
    commands:
      - npm install
      - npm install esbuild
  build:
    commands:
      - sam build
      - sam deploy --no-confirm-changeset --no-fail-on-empty-changeset

Upvotes: 1

Views: 953

Answers (1)

Guy
Guy

Reputation: 21

In order to have the esbuild working using CI/CD you need to make sure you have the esbuild package in the "dependencies" section in the package.json file. it will not work if it's located under the "devDependencies" section.

"dependencies": {
  "esbuild": "0.17.18"
},

Upvotes: 1

Related Questions