Skip to content

Commit

Permalink
⬆️ NPM: Bump applicationinsights from 2.9.6 to 3.4.0 (#3299)
Browse files Browse the repository at this point in the history
* ⬆️ NPM: Bump applicationinsights from 2.9.6 to 3.4.0

Bumps [applicationinsights](https://github.com/microsoft/ApplicationInsights-node.js) from 2.9.6 to 3.4.0.
- [Release notes](https://github.com/microsoft/ApplicationInsights-node.js/releases)
- [Commits](microsoft/ApplicationInsights-node.js@2.9.6...3.4.0)

---
updated-dependencies:
- dependency-name: applicationinsights
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* 🐛 Fixed error handler to use knew severity level values

* 🐛 updated megamenu and tweet embed APIs to use new exception level prop

* 🧪 Created an exception in articles page to test logging

* 🏷️ Added tsignore for explicit any

* ⬇️ Downgraded tinacms to 2.2.8 to fix dompurify error

* 🧪 Added tsignore to test console log

* using correct ts-ignore

* disable eslint rules

* removed unused typescript eslint

* bumped react  js application insights version

* ⬆️ updated lock file after updating app insights react js

* reinstalled dependencies for PNPM

* upgraded pnpm to version 9

* 🐛 Fixed app insights build error

* 🐛 Fixed bugs related to incorrect known severity levels being passed to app insights

* 🦙 Upgraded tinacms

* ◀️ Reverted tinacms due to dompurify error

* 🔒 Locked TinaCMS to a secure version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Calinator444 <[email protected]>
Co-authored-by: Calinator444 <[email protected]>
Co-authored-by: Caleb Williams [SSW] <[email protected]>
  • Loading branch information
4 people authored Nov 28, 2024
1 parent 5bcd482 commit 203b63d
Show file tree
Hide file tree
Showing 10 changed files with 2,883 additions and 2,271 deletions.
2 changes: 1 addition & 1 deletion context/app-insight-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ReactPlugin,
} from "@microsoft/applicationinsights-react-js";
import { ApplicationInsights } from "@microsoft/applicationinsights-web";
import { ReactNode, useEffect, useMemo } from "react";
import React, { ReactNode, useEffect, useMemo } from "react";

export function AppInsightsProvider({ children }: { children: ReactNode }) {
const reactPlugin = useMemo(() => new ReactPlugin(), []);
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@svgr/webpack": "^8.1.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.1",
"@tinacms/cli": "^1.6.9",
"@tinacms/cli": "1.6.9",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20.17.6",
"@types/react": "^18.3.12",
Expand Down Expand Up @@ -56,16 +56,16 @@
"@headlessui/react": "^1.7.19",
"@headlessui/tailwindcss": "^0.2.1",
"@marketsystems/nextjs13-appdir-breadcrumbs": "^1.0.4",
"@microsoft/applicationinsights-react-js": "17.3.0",
"@microsoft/applicationinsights-web": "3.3.1",
"@microsoft/applicationinsights-react-js": "^17.3.4",
"@microsoft/applicationinsights-web": "^3.3.4",
"@next/bundle-analyzer": "^15.0.3",
"@next/third-parties": "^14.2.15",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.59.0",
"@tanstack/react-query-devtools": "^5.59.0",
"animate-css-grid": "^1.5.1",
"aos": "^2.3.4",
"applicationinsights": "^2.9.5",
"applicationinsights": "^3.4.0",
"axios": "^1.7.7",
"classnames": "^2.5.1",
"dayjs": "^1.11.13",
Expand Down Expand Up @@ -93,7 +93,7 @@
"tailwind-merge": "^2.5.4",
"tailwindcss": "3.4.14",
"tailwindcss-gradients": "^3.0.0",
"tinacms": "^2.2.8",
"tinacms": "2.2.8",
"typescript": "^5.6.3",
"usehooks-ts": "^3.1.0",
"xss": "^1.0.15",
Expand Down
3 changes: 2 additions & 1 deletion pages/api/add-contact-to-newsletters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default async function handler(
if (error instanceof CustomError) {
appInsight.defaultClient?.trackException({
exception: new Error(error.message),

properties: {
Method: `${PowerAutomate_Endpoint.NEWSLETTERS} - ${error.method}`,
RequestBody: error.requestBody,
Expand All @@ -49,7 +50,7 @@ export default async function handler(
RequestBody: req.body,
Status: error.response.status,
},
severity: appInsight.Contracts.SeverityLevel.Error,
severity: appInsight.KnownSeverityLevel.Error,
});
res
.status(error.response.status)
Expand Down
4 changes: 2 additions & 2 deletions pages/api/create-lead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default async function handler(
JSON.stringify(createLeadFlow.data),
createLeadFlow.status,
JSON.stringify(req.body),
appInsight.Contracts.SeverityLevel.Critical,
appInsight.KnownSeverityLevel.Critical,
STAGE.PA_FLOW
);
}
Expand All @@ -63,7 +63,7 @@ export default async function handler(
JSON.stringify(recaptchaValidation.data),
recaptchaValidation.status,
JSON.stringify(req.body),
appInsight.Contracts.SeverityLevel.Error,
appInsight.KnownSeverityLevel.Error,
STAGE.GOOGLE_RECAPTCHA
);
}
Expand Down
2 changes: 1 addition & 1 deletion pages/api/get-megamenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default async function handler(
Request: "GET /api/get-megamenu",
Status: 500,
},
severity: appInsights.Contracts.SeverityLevel.Error,
severity: appInsights.KnownSeverityLevel.Error,
});

console.error(err);
Expand Down
2 changes: 1 addition & 1 deletion pages/api/get-tweet-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function handler(
Status: 500,
},
exception: err,
severity: appInsights.Contracts.SeverityLevel.Error,
severity: appInsights.KnownSeverityLevel.Error,
});
res.status(500).json({ message: err.message });
}
Expand Down
5,119 changes: 2,864 additions & 2,255 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions services/server/customError.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { KnownSeverityLevel } from "applicationinsights";

export class CustomError extends Error {
statusCode: number;
requestBody: string;
severity: number;
severity: KnownSeverityLevel;
method: string;

constructor(
message: string,
statusCode: number,
requestBody?: string,
severity?: number,
severity?: KnownSeverityLevel,
method?: string
) {
super(message);
Expand Down
4 changes: 2 additions & 2 deletions services/server/power-automate-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const invokePowerAutomateFlow = async (
JSON.stringify(data),
axiosError.response &&
axiosError.response.status === HttpStatusCode.Conflict
? appInsight.Contracts.SeverityLevel.Information
: appInsight.Contracts.SeverityLevel.Critical,
? appInsight.KnownSeverityLevel.Information
: appInsight.KnownSeverityLevel.Error,
STAGE.PA_FLOW_AXIOS
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion tina/tina-lock.json

Large diffs are not rendered by default.

0 comments on commit 203b63d

Please sign in to comment.