Create Teams response returning null

Open
#1,874 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
api

Research direction

Reproduce the client.api('/teams').post(createTeamPayload) call and inspect how its response is exposed, especially the ReadableStream and response.headers values. Compare the observed result with the expected 202 response and location headers; done means the SDK provides the relevant response metadata without returning undefined.

Written by the indexing model from the issue text.

Description

Needs: Attention :wave:
const createTeam = async (accessToken: string, teamName: string) => {
        const userId = USER_DETAILS['email'];
        const client = Client.initWithMiddleware({
            authProvider: new CustomTokenCredential(accessToken),
        });

        const createTeamPayload = {
            "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
            "displayName": "Roundglass",
            "description": "My Sample Team's Description",
            "members": [
                {
                    "@odata.type": "#microsoft.graph.aadUserConversationMember",
                    "roles": ["owner"],
                    "user@odata.bind": "https://graph.microsoft.com/v1.0/users/" + userId
                }
            ]
        };

        try {
            const response = await client.api('/teams').post(createTeamPayload);
            console.log(response);
            console.log("Team created:", response.headers);
            console.log("Team created:", response.headers.location);
        } catch (error) {
            console.error("Error creating team:", error);
        }
    };

this is response which is coming

ReadableStream {locked: false}locked: false[[Prototype]]: ReadableStream
   Team created: undefined
  

expected response should be

    HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /teams('dbd8de4f-5d47-48da-87f1-594bed003375')/operations('3a6fdce1-c261-48bc-89de-1cfef658c0d5')
Content-Location: /teams('dbd8de4f-5d47-48da-87f1-594bed003375')
Content-Length: 0
Dominant language
TypeScript
Stars
833
Forks
240
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoftgraph/msgraph-sdk-javascript

All issues in microsoftgraph/msgraph-sdk-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.