I'm trying to set up a CI/CD pipeline for some Lambda functions, but I'm stuck because the build phase logs in the console just keep spinning without showing any output. I remember experiencing something similar in a different project last year, but I can't recall how I resolved it.
The code I'm using is based on a working set of CDK code meant for ECS Fargate, and I need to adapt it for Lambda deployment. Here's a snippet of the build project configuration:
```javascript
const projectBuild = new cb.Project(this, `projectBuild`, {
projectName: `projectBuildLambdaTestPipeline`,
environment: {
buildImage: cb.LinuxBuildImage.AMAZON_LINUX_2_5,
computeType: cb.ComputeType.SMALL,
privileged: true,
},
vpc,
securityGroups: [privateSG],
buildSpec: cb.BuildSpec.fromObject({
version: 0.2,
phases: {
install: {
"runtime-versions": {
nodejs: 22,
},
commands: ["ls", "npm i -g aws-cdk@latest", "npm i"],
},
},
}),
});
```
I also have a Stack defined for the Lambda function where I specify the handler and runtime. Despite having added permissions for logs, I'm not seeing anything. Just to note, I'm testing this in a Plural Sight AWS sandbox and pulling Lambda code from an S3 bucket. Any tips on how to diagnose this?
4 Answers
Exactly! In my experience, I've found that the build logs need specific permissions to write, like `logs:CreateLogGroup`, `logs:CreateLogStream`, and `logs:PutLogEvents`. Make sure those actions are included in your role policy.
And don't forget to ensure that your CodeBuild project is properly linked to the log group. Verify that the log group exists in the specified region and is correctly referenced in your role permissions.
You can also try checking the permissions document for the role associated with your CodePipeline build project. A common pitfall is having the right actions but not the right resources. Make sure the resources specified match your project and the log group you're trying to write to.
It sounds like you might have a permissions issue. Check if the role for your build logs has the right permissions assigned. Sometimes AWS can be pretty picky about policies being in place, and a missing permission can cause logs not to appear.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically