msgraph-sdk-typescript icon indicating copy to clipboard operation
msgraph-sdk-typescript copied to clipboard

Missing peer dependency @microsoft/kiota-abstractions

Open danilofuchs opened this issue 4 months ago • 0 comments

Describe the bug

pnpm is very strict for peer dependencies.

@microsoft/msgraph-sdk depends on @microsoft/kiota-abstractions in graphServiceClient.ts:

import { apiClientProxifier } from '@microsoft/kiota-abstractions';

But does not declare it as dep/peer-dep in package.json so pnpm does not link them together by default.

Expected behavior

Should be able to use this library with ESM

How to reproduce

Install using pnpm 10 with Global Virtual Store:

pnpm config -g set enable-global-virtual-store true

pnpm install @microsoft/msgraph-sdk

Create a Typescript file, in ESM mode:

import { createGraphServiceClient } from "@microsoft/msgraph-sdk"
Error: Cannot find package '@microsoft/kiota-abstractions' imported from /home/danilo/.local/share/pnpm/store/v10/links/@microsoft/msgraph-sdk/1.0.0-preview.65/301ee8361a596b0be95f081b5c450df00457b5d3f04e31c01bc2a7d5f4db22f1/node_modules/@microsoft/msgraph-sdk/graphServiceClient.js
Did you mean to import "@microsoft/kiota-abstractions/dist/es/src/index.js"?

SDK Version

@microsoft/msgraph-sdk 1.0.0-preview.65

Latest version known to work for scenario above?

No response

Known Workarounds

Add peerDependencies as overrides in package.json:

{
  "pnpm": {
    "packageExtensions": {
      "@microsoft/msgraph-sdk": {
        "peerDependencies": {
          "@microsoft/kiota-abstractions": ">=1.0.0-preview.96",
          "@microsoft/kiota-http-fetchlibrary": ">=1.0.0-preview.96"
        }
      },
      "@microsoft/msgraph-sdk-core": {
        "peerDependencies": {
          "@microsoft/kiota-abstractions": ">=1.0.0-preview.96",
          "@microsoft/kiota-http-fetchlibrary": ">=1.0.0-preview.96"
        }
      },
      "@microsoft/msgraph-sdk-users": {
        "peerDependencies": {
          "@microsoft/kiota-abstractions": ">=1.0.0-preview.96",
          "@microsoft/kiota-http-fetchlibrary": ">=1.0.0-preview.96"
        }
      }
    }
  }
}

Debug output

Click to expand log ```
</details>


### Configuration

 System:
    OS: Linux 6.12 Pop!_OS 22.04 LTS
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz
    Memory: 4.16 GB / 31.07 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 22.14.0 - ~/n/bin/node
    npm: 11.3.0 - ~/n/bin/npm
    pnpm: 10.13.1 - ~/.local/share/pnpm/pnpm
    bun: 1.2.17 - ~/.bun/bin/bun
  npmPackages:
    @microsoft/kiota-abstractions: 1.0.0-preview.96 => 1.0.0-preview.96 
    @microsoft/kiota-authentication-azure: 1.0.0-preview.96 => 1.0.0-preview.96 
    @microsoft/msgraph-sdk: 1.0.0-preview.65 => 1.0.0-preview.65 
    @microsoft/msgraph-sdk-users: 1.0.0-preview.65 => 1.0.0-preview.65 

### Other information

_No response_

danilofuchs avatar Jul 24 '25 17:07 danilofuchs