aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
114 stars 65 forks source link

[Bug]: FetchPlugin fails when initiating #460

Closed de87684333 closed 8 months ago

de87684333 commented 8 months ago

Which web client version did you detect this bug with?

v1.15.0

What environment (build systems, module system, and framework) did you detect this bug with?

TypeScript v5.1.6, Webpack v4.46.0, ECMAScript modules (ESM), Angular 16.2.8

Is your web application a single page application (SPA) or multi page application (MPA)?

None

Please provide your web client configuration

{ allowCookies: true, endpoint: "https://dataplane.rum.us-west-2.amazonaws.com", guestRoleArn: "arn:aws:iam::000000000000:role/RUM-Monitor-us-west-2-000000000000-00xx-Unauth", identityPoolId: "us-west-2:00000000-0000-0000-0000-000000000000", sessionSampleRate: 1, telemetries: ['errors', 'performance', 'http'] }

Please describe the bug/issue

Since Tuesday and the update of @types/nodes to v20.8.4 (https://www.npmjs.com/package/@types/node/v/20.8.4), my angular project was failing during 'ng test' or 'ng serve' command.

At first, the project was working with the version 1.15.0 of aws-rum-web but then failed with the following error in FetchPlugin

error TS2416: Property 'patches' in type 'FetchPlugin' is not assignable to the same property in base type 'MonkeyPatched<Window, "fetch">'
[...]
Property 'referrer' is missing in type 'import("/home/runner/work/periscop-front/periscop-front/node_modules/undici-types/fetch").Request' but required in type 'Request'.

I was able to make my project works again by downgrading explicitly the @types/node version.

qiah commented 8 months ago

Hi @de87684333, are you also using node 20 for your project. "type" issue usually happens when the @types/node and node version doesn't match.

de87684333 commented 8 months ago

Hi @qiah, I tried with node v20, I still get the issue. Nevertheless, Angular v16 is not compatible with node v20 it could be an issue.

But the fact is application is working with v20.8.3 of @types/node but not with the v20.8.4 or v20.8.5

limhjgrace commented 8 months ago

Hello, according to the Angular documentation, it seems that that is expected as Angular v16 is not yet "officially" compatible with node v20. It seems that downgrading the node version is a valid workaround. Please reopen the ticket should there be any additional questions!