Skip to content

fix: error when current context is undefined#870

Merged
shazron merged 2 commits intomasterfrom
current-context-undefined
May 30, 2025
Merged

fix: error when current context is undefined#870
shazron merged 2 commits intomasterfrom
current-context-undefined

Conversation

@shazron
Copy link
Copy Markdown
Member

@shazron shazron commented May 29, 2025

The error is:

❯ aio app init test-project
 ›   Error: [IMSSDK:CONTEXT_NOT_CONFIGURED] IMS context '%s' is not configured

Description

When the current ims context is not set, you can't get an access token. A truthy check was missing.

How Has This Been Tested?

  • aio plugins link . to this PR branch
  • delete any ims login via aio config del ims
  • aio app init test-project
  • should not error

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8db2d5d) to head (00f8be7).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #870   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           57        57           
  Lines         3251      3251           
  Branches       630       630           
=========================================
  Hits          3251      3251           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@purplecabbage purplecabbage requested a review from Copilot May 29, 2025 17:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an error encountered when the current IMS context is undefined by adding a proper truthy check before overriding the CLI context in the getAccessToken flow.

  • Updated test to simulate an undefined current context.
  • Modified auth-helper.js to conditionally use the current context only if it is truthy.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/commands/lib/auth-helper.test.js Adjusted test description and simulated a scenario with an undefined current context.
src/lib/auth-helper.js Introduced a truthy check to ensure the current context is defined before overriding the default.

Comment thread src/lib/auth-helper.js
@shazron shazron merged commit a1b8bda into master May 30, 2025
10 checks passed
@shazron shazron deleted the current-context-undefined branch May 30, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants