Reputation: 19
I'm trying to build the sam project with sam build command but getting the error no version information available in sam build stage, need some input on how to pass the version information of mkdir so the build stage would be successful I have tried various workarounds but it's not working
here is the error
Error: CustomMakeBuilder:MakeBuild - Make Failed: mkdir: /usr/local/aws-sam-cli/1.76.0/dist/libselinux.so.1: no version information available (required by mkdir)
here its make file
.PHONY: build-RuntimeDependenciesLayer build-lambda-common
.PHONY: build-getAllItemsFunction build-getByIdFunction build-putItemFunction
build-StoresFunction:
$(MAKE) HANDLER=src/handlers/stores.ts build-lambda-common
build-loginFunction:
$(MAKE) HANDLER=src/handlers/login.ts build-lambda-common
build-addStoreFunction:
$(MAKE) HANDLER=src/handlers/add-store.ts build-lambda-common
build-updateStoreFunction:
$(MAKE) HANDLER=src/handlers/update-store.ts build-lambda-common
build-bulkInsertStoresFunction:
$(MAKE) HANDLER=src/handlers/bulk-insert-stores.ts build-lambda-common
build-sendEmailFunction:
$(MAKE) HANDLER=src/handlers/send-email.ts build-lambda-common
build-lambda-common:
npm install
rm -rf dist
echo "{\"extends\": \"./tsconfig.json\", \"include\": [\"${HANDLER}\"] }" > tsconfig-only-handler.json
npm run build -- --build tsconfig-only-handler.json
cp -r dist "$(ARTIFACTS_DIR)/"
build-RuntimeDependenciesLayer:
mkdir -p "$(ARTIFACTS_DIR)/nodejs"
cp package.json package-lock.json "$(ARTIFACTS_DIR)/nodejs/"
npm install --production --prefix "$(ARTIFACTS_DIR)/nodejs/"
rm "$(ARTIFACTS_DIR)/nodejs/package.json" # to avoid rebuilding when changes doesn't relate to dependencies
here is the pipeline code of github actions
name: GitHub-Actions
on:
push:
branches:
- main
env:
AWS_REGION: ap-south-1
LAMBDA_FUNCTION_NAME: Absolute
ZIP_FILE_NAME: mycode.zip
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: Production
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: npm install --force
- name: install make
run: sudo apt-get install -y make
- name: install mkdir
run: sudo apt-get install --reinstall coreutils
- name: Build function
run: sam build
- name: check build folder
run: cd .aws-sam/build && ls -all
- name: Install zip
uses: montudor/action-zip@v1
- name: Zip output
run: zip -rv mycode.zip . -i build/AddStoreFunction/* build/BulkInsertStoresFunction/* build/GetAllStoresFunction/* build/LoginFunction/* build/template.yaml
working-directory: .aws-sam
- name: List Files
run: cd .aws-sam && ls -all
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Update Lambda function code
run: aws lambda update-function-code --function-name Absolute --no-cli-pager --publish --zip-file fileb://.aws-sam/mycode.zip
Upvotes: 1
Views: 166