Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

getStream doesn't work on node 18

オープン
#946 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript
領域
api, backend

調査の方向性

Start by reproducing the failure with Node 18.8.0 using client.api(imageUrl).getStream() from the report, then trace the SDK entry point for .getStream() and how its response is handled. Done means the call returns a stream that supports stream.on('data', ...) for the reported photo request.

索引モデルが issue の本文から書いたものです。

説明

breaking change P0

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.

Description

The .getStream() method doesn't work when running on node 18.

Console Errors: [Is there any console error]

TypeError: stream.on is not a function

Screenshots: [If applicable, add screenshots to help explain your problem]

image

Steps to Reproduce

Here is a small application to reproduce the issue(just include the IDs):

import 'isomorphic-fetch'; // unnecessary and can be removed
import { Client } from '@microsoft/microsoft-graph-client';

const tenantId = '';
const clientId = '';
const clientSecret = '';
const userID = '';

const createAccessToken = async ({ tenantId, clientId, clientSecret }) => {
  const params = new URLSearchParams();
  params.append('grant_type', 'client_credentials');
  params.append('client_id', clientId);
  params.append('client_secret', clientSecret);
  params.append('scope', 'https://graph.microsoft.com/.default');

  const response = await fetch(
    `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`,
    {
      method: 'POST',
      body: params,
    }
  );

  const { access_token } = await response.json();

  return access_token;
};

const createClient = async connectionConfig => {
  const accessToken = await createAccessToken(connectionConfig);

  return Client.init({
    authProvider: done => {
      done(null, accessToken);
    },
  });
};

const run = async () => {
  const imageUrl = `/users/${userID}/photo/$value`;
  const client = await createClient({ tenantId, clientId, clientSecret });

  const photo = await client.api(imageUrl).get();
  console.log({ photo }); // <-- photo is loaded

  const stream = await client.api(imageUrl).getStream();
  // fails with: stream.on is not a function
  stream.on('data', data => {
    console.log(data);
  });
};

run();

Expected behavior: [What you expected to happen]

a stream to be returned by .getStream() function

Actual behavior: [What actually happened]

.getStream() function is not returning a stream

Additional Context

Node 18 is used

Usage Information

Request ID - Value of the requestId field if you are receiving a Graph API error response

SDK Version - [SDK version you are using]

3.0.2

  • Node (Check, if using Node version of SDK)

Node Version - [The version of Node you are using]

18.8.0

主要言語
TypeScript
スター
833
フォーク
240
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoftgraph/msgraph-sdk-javascript のほかの issue

microsoftgraph/msgraph-sdk-javascript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。