DOP-C02 SDLC Automation Practice Question
Exhibit
Refer to the exhibit.
# Buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'Refer to the exhibit. A CodeBuild project uses this buildspec. The build fails with the error: 'The runtime version specified is not supported in this environment.' What change should be made?
⚠ Common exam trap
Test-takers frequently assume they can install any Node.js version manually (Option A or B) without realizing that the runtime-versions section is validated against the managed image's pre-configured runtime manager, and the error is not about missing Node.js but about the version not being in the allowed list.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Update the runtime-versions to nodejs: 14.
The CodeBuild managed image for the specified environment (likely Ubuntu Standard 5.0 or similar) only supports Node.js runtime versions 14 and above. The error indicates that Node.js 12 is not available in the runtime-versions section of the buildspec for that environment. Updating to nodejs: 14 aligns with the supported runtime versions in the managed image, resolving the error without requiring custom images or manual installation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add an install command to install Node.js 12 from source.
Why it's wrong here
Compiling Node.js 12 from source inside the buildspec is unnecessary and counterproductive because CodeBuild's managed runtime-versions section already provides pre-installed, supported runtimes. Building from source requires installing compilers and dependencies, drastically increasing build time and introducing potential build failures that are unrelated to your application code. Since a supported Node.js version can simply be selected, this approach is neither the simplest nor the most reliable fix for the deprecated-runtime error.
- ✗
Remove the runtime-versions section and install Node.js manually.
Why it's wrong here
Manually installing Node.js after removing the runtime-versions section works in principle, but it is not the cleanest solution because you forfeit CodeBuild's managed runtime lifecycle. A manual install using curl or a package manager is slower, may not be cached across builds, and can be affected by network or OS-level changes. The correct, minimal fix is to specify a supported runtime version in runtime-versions, which uses CodeBuild's pre-installed, tested environment instead of ad-hoc installation.
- ✓
Update the runtime-versions to nodejs: 14.
Why this is correct
Updating runtime-versions to nodejs:14 is the correct fix because the CodeBuild standard image likely no longer includes Node.js 12 after that version reached end-of-life or was deprecated from the managed environment. By specifying an actively supported runtime like Node.js 14, CodeBuild provisions the matching pre-installed runtime, eliminating the "run not available" error. This change is simple, declarative, and leverages CodeBuild's managed image updates without requiring manual installation or custom images.
- ✗
Change the build environment to use a custom image that includes Node.js 12.
Why it's wrong here
Switching to a custom image that includes Node.js 12 is technically valid, but it introduces unnecessary overhead: you must create, maintain, and push the image to a container registry, then configure the CodeBuild project to reference it. This approach also locks you into managing base image updates and security patches yourself, whereas the standard managed image with a supported runtime-version declaration does that for you. Given that a one-line version change resolves the issue, a custom image is not the most straightforward or cost-effective solution.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 251 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.