microsoftgraph / microsoftgraph/msgraph-sdk-typescript

Missing peer dependency @microsoft/kiota-abstractions

Open
#858 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:waiting-for-triage ToTriage type:bug
Dominant language
TypeScript
Stars
44
Forks
7
Avg merge
12h 40m
Merged PRs (30d)
5

Description

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_

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.

Research direction

Start with graphServiceClient.ts and the package.json files for @microsoft/msgraph-sdk and related packages, then reproduce the ESM install with pnpm 10 and the global virtual store. Check that the required Kiota packages are declared so a clean installation resolves the import without packageExtensions; the TypeScript ESM example should run successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.