Specific endpoint call fails by fetch of node v18
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
Reproduce the request from the issue using Node v18.10.0, SDK 3.0.2, and the applications endpoint, then compare it with Node v16 and NODE_OPTIONS=--no-experimental-fetch. Start by tracing the SDK's fetch-based request path around GraphRequest.ts and GraphErrorHandler.ts. Done means fetching a specific application returns its properties under Node 18 without the Invalid language specified error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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 fetch of node v18 introduces a bug to msgraph-sdk-javascript.
This is simple code.
public async getApplications(): Promise<any> {
return await this.client
.api(`/applications`)
.get();
}
public async getApplication(): Promise<any> {
return await this.client
.api(`/applications/deadbeef-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)
.get();
}
This works well with node v16.
However, in v18 it outputs following error.
❯ npx ts-node script/nishida-sample.ts
https://graph.microsoft.com/v1.0/applications/deadbeef-xxxx-xxxx-xxxx-xxxxxxxxxxxx
(node:99543) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/@microsoft/microsoft-graph-client/src/GraphError.ts:61
super(message || (baseError && baseError.message));
^
GraphError: Invalid language specified.
at new GraphError (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/@microsoft/microsoft-graph-client/src/GraphError.ts:61:3)
at Function.GraphErrorHandler.constructErrorFromResponse (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/@microsoft/microsoft-graph-client/src/GraphErrorHandler.ts:76:18)
at Function.<anonymous> (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/@microsoft/microsoft-graph-client/src/GraphErrorHandler.ts:102:31)
at step (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/tslib/tslib.js:144:27)
at Object.next (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/tslib/tslib.js:125:57)
at /Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/tslib/tslib.js:118:75
at new Promise (<anonymous>)
at __awaiter (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/tslib/tslib.js:114:16)
at Function.GraphErrorHandler.getError (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphErrorHandler.js:85:38)
at GraphRequest.<anonymous> (/Users/kazufumi.nishida/code/_infra_others/graph-api-sandbox/node_modules/@microsoft/microsoft-graph-client/src/GraphRequest.ts:391:55) {
statusCode: 400,
code: 'Request_BadRequest',
requestId: '329b85ba-dc7a-4712-b9b7-89e3907972c8',
date: 2022-10-11T18:44:18.000Z,
body: '{"code":"Request_BadRequest","message":"Invalid language specified.","innerError":{"date":"2022-10-12T03:44:18","request-id":"329b85ba-dc7a-4712-b9b7-89e3907972c8","client-request-id":"2729c80a-94c7-748f-31c2-fe56bb594a84"}}'
}
Also, it works once more with --no-experimental-fetch.
❯ NODE_OPTIONS=--no-experimental-fetch npx ts-node script/nishida-sample.ts
https://graph.microsoft.com/v1.0/applications/deadbeef-xxxx-xxxx-xxxx-xxxxxxxxxxxx
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#applications/$entity","id":"
...
}
Steps to Reproduce
- Use node v18
- Setup ordinally (https://github.com/microsoftgraph/msgraph-sdk-javascript/tree/099afbe343cd279f218036a83eb2831ad065f46d#getting-started)
- Access
v1.0/applications/deadbeef-xxxx-xxxx-xxxx-xxxxxxxxxxxx(use existing application id in your tenant)
Expected behavior: [What you expected to happen]
Return application property
Actual behavior: [What actually happened]
GraphError: Invalid language specified.
Additional Context
I was struggling 13 hours because new fetch of v18 works well except GET v1.0/applications/deadbeef-xxxx-xxxx-xxxx-xxxxxxxxxxxx endpoint. E.g, GET v1.0/applications endpoint (list applications) works correctly.
Usage Information
Request ID - Value of the requestId field if you are receiving a Graph API error response
329b85ba-dc7a-4712-b9b7-89e3907972c8
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]
❯ node --version
v18.10.0
- Browser (Check, if using Browser version of SDK)
Browser Name - [The name of Browser that you are using for SDK]
Version - [The version of the browser you are using]
P.S.
Thank you good library. I'm happy to code with type informations.
- Ngôn ngữ chính
- TypeScript
- Star
- 833
- Fork
- 240
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoftgraph/msgraph-sdk-javascript
-
status:waiting-for-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
-
Is anyone here? Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
microsoftgraph/msgraph-sdk-javascript#2005 · 1 reaction ·
-
Is it really correct that the Javascript version of the graph SDK doesn't offer typed requests? Đang mởstatus:waiting-for-triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
-
status:waiting-for-triage type:bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
microsoftgraph/msgraph-sdk-javascript#1999 · 2 bình luận · 1 reaction ·
-
status:waiting-for-triage type:bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của microsoftgraph/msgraph-sdk-javascript
Issue tương tự
-
Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenNSW/nsw-srilanka#497 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
digidem/comapeo-cloud-app#403 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100