Skip to content

app.initialize() succeeds but getContext() never returns in Teams tab #80

Open

Description

@Ashlesha-MSFT

I’m developing a Microsoft Teams tab using @microsoft/teams-js.

I initialize the SDK like this:

import { app } from "@microsoft/teams-js";

async function init() {
await app.initialize();

const context = await app.getContext();
console.log(context);
}

init();

app.initialize() completes successfully, but app.getContext() does not appear to resolve when the app is running as a Teams tab.

Is this the correct initialization pattern for the current Teams JS SDK? If not, what should I change, and are there any lifecycle or host-specific requirements I should be aware of?

SDK version: @microsoft/teams-js 2.x
Host: Microsoft Teams desktop

Activity

  1. atktroubleshootingapp commented on Sep 29, 2026

    @atktroubleshootingapp

    👋 Hi @Ashlesha-MSFT,

    Thank you for reporting this issue. Here is an AI-generated initial response:

    Classification: Upstream — the TeamsJS v2 call sequence is correct; if getContext() remains pending in a Teams tab, the cause appears to be outside the tab’s initialization code, but SDK-versus-host ownership is unverified.

    • The API contract requires app.initialize() to resolve before other SDK calls and says app.getContext() returns a promise for the current frame’s context.
    • A related report describes a pending getContext() after initialization, but in a message-extension authentication flow, not an ordinary tab. It is not an established duplicate.

    What to do now:

    1. Keep the existing await app.initialize(); await app.getContext() sequence; don’t switch to the v1 callback API.
    2. Confirm the code runs in the tab’s content frame. Compare Teams desktop with Teams web, and log whether the promise rejects or stays pending.
    3. Share the exact @microsoft/teams-js version, Teams desktop version, OS, manifest tab settings, and a minimal reproduction. No fixing TeamsJS version is established for this symptom.

    Useful links:


    Note: AI-generated guidance may be incomplete or incorrect. Please verify suggestions before applying them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI-generated responseAn AI-generated response has been posted to this issue.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions