Comments (14)
I found the bug I'm sorry, it seems I forgot to install esbuild dependency at the lambda level, it was only installed at the root lebel.
from setup-sam.
Per the error message:
esbuild must be installed on the host machine to use this feature.
Do you have eslint
installed on the machine running the workflow?
from setup-sam.
Yes I did install it with npm i -g esbuild
, is there a different way to do this ?
from setup-sam.
So to be clear, esbuild
is installed in the GitHub Actions environment (not only on development machine), and is in the PATH
(i.e. you can use esbuild
and it'll call the executable correctly)?
from setup-sam.
I run npm i -g esbuild
and then run esbuild --version
it displays the correct version 0.18.6
from setup-sam.
Can you include the relevant parts of your GitHub workflow? Specifically, where eslint and SAM CLI is installed, and where SAM CLI is called.
from setup-sam.
jobs:
build-and-package:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm i -g esbuild
- run: esbuild --version
- uses: aws-actions/setup-sam@v2
with:
use-installer: true
- name: Build resources
run: sam build --template ${SAM_TEMPLATE} --use-container
from setup-sam.
With --use-container
the project will be built in a container, so whatever is installed on the host won't be available in it. It should work if you make esbuild
a project dependency, so that it's picked up in the container as well.
from setup-sam.
Thanks for your advice, I’m not sure what I’m supposed to do, could you tell me how to do this ?
from setup-sam.
Try adding it as a dependency to your package.json
.
from setup-sam.
That’s already what I did and not working, I tried adding it to dependencies and devDependencies.
from setup-sam.
Interesting; can you share your package.json
? And project structure as well if possible (to ensure it's picking up the correct package.json
). We haven't been able to reproduce the issue.
from setup-sam.
Adding some extra context here. I was unable to reproduce this issue in GitHub actions. My setup looks like this and runs successfully
├── README.md
├── events
│ └── event.json
├── hello-world
│ ├── app.ts
│ ├── jest.config.ts
│ ├── package.json
│ ├── tests
│ │ └── unit
│ │ └── test-handler.test.ts
│ └── tsconfig.json
├── samconfig.toml
└── template.yaml
package.json
{
"name": "hello_world",
"version": "1.0.0",
"description": "hello world sample for NodeJS",
"main": "app.js",
...
},
"dependencies": {
"esbuild": "^0.14.14"
},
"devDependencies": {
...
}
}
and the workflow
name: Build
on: push
jobs:
build:
name: Build esbuild project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: aws-actions/setup-sam@v2
with:
use-installer: true
- run: sam build -u
I noticed you also specify the template. Can you confirm the template flag is pointing to the correct file?
from setup-sam.
No worries! Thanks for the update; good you found the issue.
from setup-sam.
Related Issues (20)
- Add CodeQL scanning
- Add setup-python to example
- Example without Docker HOT 1
- setup-sam is failing; AttributeError: module '__main__' has no attribute '__file__' HOT 2
- ImportError: cannot import name 'soft_unicode' from 'markupsafe' HOT 3
- Unable to install latest version of SAM HOT 4
- Getting Esbuild Failed: Cannot find esbuild in the GitHub Actions HOT 5
- sam package fails to include node_modules when --template-file is specified HOT 6
- Update @actions/core to use the file version of save-state and set-output workflow commands HOT 1
- SAM build stopped working | AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms' HOT 15
- Support native installers HOT 3
- Support caching with `use-installer` when `version` not specified HOT 2
- jsonschema new patch version breaks the deployment HOT 3
- Error: Getting requirements to build wheel did not run successfully HOT 29
- Enable custom caching with Github Actions workflow HOT 4
- Runtime Node20.x support? HOT 2
- I get following error: when run sam build --use-container command from github action HOT 1
- Intermittant Setup-Sam Failures HOT 4
- Runtime Node20.x support in github actions? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from setup-sam.