Skip to content

Conversation

@shazron
Copy link
Member

@shazron shazron commented May 29, 2025

In an AB project:

❯ aio rt trigger create trigger123
 ›   Error: failed to create the trigger: Unknown Error From API: [IMSSDK:CONTEXT_NOT_CONFIGURED] IMS context '%s' is
 ›   not configured
 ›    specify --verbose flag for more information

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
  • Go to the root of an AB project
  • aio rt trigger create trigger123
  • 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

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6e98764) to head (8678b25).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #386   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           67        67           
  Lines         1792      1793    +1     
  Branches       379       379           
=========================================
+ Hits          1792      1793    +1     

☔ 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:38
Copy link

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 ensures that when no IMS context is set, the CLI context is used by default to retrieve an access token, preventing the undefined-context error.

  • Added a truthy check around currentContext to preserve the default CLI context when it’s undefined.
  • Updated the test to mock currentContext as undefined and validate the fallback.
  • Adjusted import of CLI from the IMS library.

Reviewed Changes

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

File Description
test/DeployServiceCommand.test.js Updated test to simulate currentContext being undefined and renamed test case.
src/DeployServiceCommand.js Added currentContext truthy check; changed CLI import to a deep path.
Comments suppressed due to low confidence (1)

test/DeployServiceCommand.test.js:65

  • [nitpick] Consider adding an assertion to verify that context.setCli is invoked when currentContext is undefined to fully cover the fallback logic.
test('should use CLI context (default) if current context undefined', async () => {

@shazron shazron merged commit fd79e91 into master May 30, 2025
10 checks passed
@shazron shazron deleted the current-context-undefined branch May 30, 2025 04:40
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