Skip to content

Remove manifest.name check from send() method#416

Merged
heyitsaamir merged 2 commits into
mainfrom
copilot/fix-misleading-app-error
Dec 9, 2025
Merged

Remove manifest.name check from send() method#416
heyitsaamir merged 2 commits into
mainfrom
copilot/fix-misleading-app-error

Conversation

Copilot AI commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

In v2.0.3, app.name was changed from reading tokens.bot?.appDisplayName to manifest.name?.full. The send() method's validation check if (!this.id || !this.name) now throws "app not started" when manifest.name is not provided, even when the app has started successfully.

Changes

  • Removed !this.name validation in send() method - only !this.id is required
  • Fallback to app ID for bot name when manifest.name is undefined (name: this.name || this.id)
  • Added tests covering send with/without manifest.name, and proper error when app ID is missing

Example

// This now works without requiring manifest.name
const app = new App({
  clientId: "...",
  clientSecret: "...",
  tenantId: "...",
  // No manifest.name needed
});

await app.start();
await app.send(conversationId, "Hello"); // ✓ Works (uses app ID as bot name)

The app.name getter is already marked @deprecated and should not be used for validation.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Misleading "app not started" error when manifest.name is not configured (breaking change in v2.0.3)</issue_title>
<issue_description>### Bug Description

After upgrading from @microsoft/teams.apps v2.0.2 to v2.0.4, calls to app.send() fail with the error "app not started" even though the
app has successfully started.

The root cause is a breaking change introduced in PR microsoft/teams.ts#387 (released in v2.0.3). The
app.name getter was changed from reading the bot's display name from tokens to reading from the manifest.name constructor option:

Before (v2.0.2) - app.ts L136-L138:

get name() {
  return this.tokens.bot?.appDisplayName;
}

After (v2.0.3+) - app.ts L175-L177:

get name() {
 return this._manifest.name?.full;
}

The send() method checks if (!this.id || !this.name) and throws "app not started", but this error message is misleading because:

  1. The app is started (app.start() completed successfully)
  2. The actual issue is that manifest.name was not provided in the constructor

This is a breaking change that affects any code I had using app.send() for proactive messaging.

Steps to Reproduce

  1. Install @microsoft/teams.apps v2.0.3 or later
  2. Create an App instance without the manifest.name option:
const app = new App({
  clientId: "...",
  clientSecret: "...",
  tenantId: "...",
});
  1. Start the app and call app.send():
    await app.start(3978);
    await app.send(conversationId, "Hello"); // Throws "app not started"

Expected Behavior

Either:

  • The error message should indicate the actual problem (e.g., "manifest.name is required for app.send()")
  • Or the SDK should fall back to this.tokens.bot?.appDisplayName for backwards compatibility

Actual Behavior

Throws Error: app not started which is misleading

Workaround: Add manifest.name to the App constructor:

const app = new App({
  clientId: "...",
  clientSecret: "...",
  tenantId: "...",
  manifest: {
    name: { short: "MyApp", full: "My Application" },
  },
});

SDK Version

2.0.4

Node.js Version

24.5.0

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@heyitsaamir Thanks! Yeah that is indeed a bug. We should not be looking at the name when preparing to send.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…igured

Remove the unnecessary check for `!this.name` in the `send()` method since the name is already deprecated and not required for sending messages. The app ID is sufficient to ensure the app is properly initialized. When manifest.name is not provided, fallback to using the app ID as the bot name in the ConversationReference.

Added tests to verify:
- send() works without manifest.name (uses app ID as fallback)
- send() works with manifest.name configured
- send() throws proper error when app ID is missing

Co-authored-by: heyitsaamir <[email protected]>
Copilot AI changed the title [WIP] Fix misleading 'app not started' error in v2.0.4 Remove manifest.name check from send() method Dec 4, 2025
Copilot AI requested a review from heyitsaamir December 4, 2025 22:27
@heyitsaamir
heyitsaamir marked this pull request as ready for review December 5, 2025 02:44
@heyitsaamir
heyitsaamir requested a review from lilyydu December 5, 2025 19:39
@heyitsaamir

Copy link
Copy Markdown
Collaborator

Confirmed that this works as expected - tested with no manifest name set, and proactive message was still successfully sent.

@heyitsaamir
heyitsaamir merged commit 773ec97 into main Dec 9, 2025
13 checks passed
@heyitsaamir
heyitsaamir deleted the copilot/fix-misleading-app-error branch December 9, 2025 18:52
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.

[Bug]: Misleading "app not started" error when manifest.name is not configured (breaking change in v2.0.3)

3 participants