Hello everyone,
I had followed the Serverless tutorials and created my first project. I came across the issues, some I have fixed but others I do the work around. I need guidance to resolve the pending issues.
1- Deployment through serverless works well, but when I integrate with bitbucket->Codepipeline->Codebuild. I am saving the node_modules in a layer, which includes the serverless-plugin-tracing. it gives the below error.
Deploy Stage:
#! /bin/bash
npm install -g serverless --unsafe-perm
ls -ltor $CODEBUILD_SRC_DIR/target/$env
serverless deploy --stage $env --package $CODEBUILD_SRC_DIR/target/$env -v
Error:
Serverless Error ----------------------------------------
62
63 Serverless plugin “serverless-plugin-tracing” not found. Make sure it’s installed and listed in the “plugins” section of your serverless config file.
Output from deploy directory:
Enviroment:
54 dev
55 total 10612
56 -rw-r–r-- 1 root 34264 Mar 30 03:40 serverless-state.json
57 -rw-r–r-- 1 root 10795614 Mar 30 03:40 nodemodules.zip
58 -rw-r–r-- 1 root 10048 Mar 30 03:40 datahubToAlmaservice.zip
59 -rw-r–r-- 1 root 19104 Mar 30 03:40 cloudformation-template-update-stack.json
Plugin:
plugins:
localPath: ‘./layer/nodejs/node_modules’
modules:
- serverless-plugin-tracing
Layers:
layers:
nodemodules:
path: layer # required, path to layer contents on disk
#name: nodemodulesLayer # optional, Deployed Lambda layer name
description: Node modules will install here # optional, Description to publish to AWS
compatibleRuntimes: # optional, a list of runtimes this layer is compatible with
- nodejs14.x
licenseInfo: GPLv3 # optional, a string specifying license information
retain: false # optional, false by default. If true, layer versions are not deleted as new ones are created
Build stage working fine.
version: 0.2
phases:
install:
commands:
- npm install --silent --no-progress -g npm --unsafe-perm
- npm install --silent --no-progress -g serverless --unsafe-perm
pre_build:
commands:
- npm install --no-progress --silent --unsafe-perm
- npm install --save --no-progress --silent serverless-plugin-tracing --unsafe-perm
build:
commands:
- mkdir -p layer/nodejs/
- mv node_modules layer/nodejs/
- ls -ltor
- ls -ltor layer
- ls -ltor layer/nodejs
- mkdir -p target/dev
- mkdir target/production
- serverless package --package target/dev --stage dev -v
- serverless package --package target/production --stage production -v
artifacts:
files:
- target/**/*
- serverless.yml
- deploy.sh