aws-amplify / aws-amplify/amplify-hosting

NPM Package Version as ENV Variable

Open
#2,720 0 comments 4 reactions 0 assignees View on GitHub
feature-request
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

Accessing the NPM Package Version within an Amplify hosted application is incredibly helpful for many sites and important features. The front end should be able to track its own version, and format pages accordingly. A simple example need would be version tracking for error reporting. A service like [Sentry](sentry.io) uses the site version to track errors between versions. This is currently impossible with Amplify without manually manipulating env variables.

Solution: expose $npm_package_version to the Amplify environment variables dynamically, or set automatically. Issue #1472 seems to indicate this was possible at one point.

The only way to currently do this is to manually update the environment variable in the Amplify console every time a version is made. This makes it tedious and a risk of incorrect version matching if a developer forgets to do so.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing issue #1472 and the Amplify Hosting environment-variable and build flow described here. Confirm how the NPM package version could be exposed dynamically, including the expected behavior for hosted applications, and consider the existing Amplify console workflow. Done means the version is available without manual updates and matches the deployed package version.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
ci-cd, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.