@akinon/next 1.82.0-rc.6 → 1.82.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/instrumentation/node.ts +15 -13
- package/middlewares/locale.ts +2 -9
- package/package.json +2 -2
- package/sentry/index.ts +35 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.82.0-rc.8
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 17bfadc: ZERO-3275: Disable OpenTelemetry monitoring in production environment
|
|
8
|
+
|
|
9
|
+
## 1.82.0-rc.7
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- c3b2f3f: ZERO-3267: Enable sentry client errors and filter them by log type
|
|
14
|
+
|
|
3
15
|
## 1.82.0-rc.6
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/instrumentation/node.ts
CHANGED
|
@@ -4,17 +4,19 @@ import { Resource } from '@opentelemetry/resources';
|
|
|
4
4
|
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
5
5
|
import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
new
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
const sdk = new NodeSDK({
|
|
9
|
+
resource: new Resource({
|
|
10
|
+
[SemanticResourceAttributes.SERVICE_NAME]: 'pz-next-app'
|
|
11
|
+
}),
|
|
12
|
+
spanProcessor: new SimpleSpanProcessor(
|
|
13
|
+
new OTLPTraceExporter({
|
|
14
|
+
url: `${
|
|
15
|
+
process.env.PZ_DASHBOARD_URL ?? 'http://localhost:3005'
|
|
16
|
+
}/api/traces`
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
});
|
|
19
20
|
|
|
20
|
-
sdk.start();
|
|
21
|
+
sdk.start();
|
|
22
|
+
}
|
package/middlewares/locale.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { PzNextRequest } from '.';
|
|
|
4
4
|
import { LocaleUrlStrategy } from '../localization';
|
|
5
5
|
import { urlLocaleMatcherRegex } from '../utils';
|
|
6
6
|
import logger from '../utils/log';
|
|
7
|
-
import { getUrlPathWithLocale } from '../utils/localization';
|
|
8
7
|
|
|
9
8
|
const getMatchedLocale = (pathname: string) => {
|
|
10
9
|
let matchedLocale = pathname.match(urlLocaleMatcherRegex)?.[0] ?? '';
|
|
@@ -51,14 +50,8 @@ const withLocale =
|
|
|
51
50
|
redirectToDefaultLocale &&
|
|
52
51
|
req.method === 'GET'
|
|
53
52
|
) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
url.pathname,
|
|
57
|
-
req.cookies.get('pz-locale')?.value
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
// Use 303 for POST requests
|
|
61
|
-
return NextResponse.redirect(url, 303);
|
|
53
|
+
url.pathname = `/${defaultLocaleValue}${url.pathname}`;
|
|
54
|
+
return NextResponse.redirect(url);
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
req.middlewareParams.rewrites.locale = matchedLocale;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.82.0-rc.
|
|
4
|
+
"version": "1.82.0-rc.8",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"set-cookie-parser": "2.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@akinon/eslint-plugin-projectzero": "1.82.0-rc.
|
|
33
|
+
"@akinon/eslint-plugin-projectzero": "1.82.0-rc.8",
|
|
34
34
|
"@types/react-redux": "7.1.30",
|
|
35
35
|
"@types/set-cookie-parser": "2.4.7",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
package/sentry/index.ts
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
import * as Sentry from '@sentry/nextjs';
|
|
2
2
|
|
|
3
|
-
const SENTRY_DSN: string =
|
|
3
|
+
const SENTRY_DSN: string | undefined =
|
|
4
4
|
process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
|
|
5
5
|
|
|
6
|
+
export enum ClientLogType {
|
|
7
|
+
UNCAUGHT_ERROR_PAGE = 'UNCAUGHT_ERROR_PAGE',
|
|
8
|
+
CHECKOUT = 'CHECKOUT'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ALLOWED_CLIENT_LOG_TYPES: ClientLogType[] = [
|
|
12
|
+
ClientLogType.UNCAUGHT_ERROR_PAGE,
|
|
13
|
+
ClientLogType.CHECKOUT
|
|
14
|
+
];
|
|
15
|
+
|
|
6
16
|
export const initSentry = (
|
|
7
17
|
type: 'Server' | 'Client' | 'Edge',
|
|
8
18
|
options: Sentry.BrowserOptions | Sentry.NodeOptions | Sentry.EdgeOptions = {}
|
|
9
19
|
) => {
|
|
10
20
|
// TODO: Handle options with ESLint rules
|
|
11
21
|
|
|
12
|
-
|
|
22
|
+
Sentry.init({
|
|
23
|
+
dsn:
|
|
24
|
+
SENTRY_DSN ||
|
|
25
|
+
'https://d8558ef8997543deacf376c7d8d7cf4b@o64293.ingest.sentry.io/4504338423742464',
|
|
26
|
+
initialScope: {
|
|
27
|
+
tags: {
|
|
28
|
+
APP_TYPE: 'ProjectZeroNext',
|
|
29
|
+
TYPE: type
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
tracesSampleRate: 1.0,
|
|
33
|
+
integrations: [],
|
|
34
|
+
beforeSend: (event, hint) => {
|
|
35
|
+
if (
|
|
36
|
+
type === 'Client' &&
|
|
37
|
+
!ALLOWED_CLIENT_LOG_TYPES.includes(
|
|
38
|
+
event.tags?.LOG_TYPE as ClientLogType
|
|
39
|
+
)
|
|
40
|
+
) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
13
43
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
SENTRY_DSN ||
|
|
18
|
-
'https://d8558ef8997543deacf376c7d8d7cf4b@o64293.ingest.sentry.io/4504338423742464',
|
|
19
|
-
initialScope: {
|
|
20
|
-
tags: {
|
|
21
|
-
APP_TYPE: 'ProjectZeroNext',
|
|
22
|
-
TYPE: type
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
tracesSampleRate: 1.0,
|
|
26
|
-
integrations: []
|
|
27
|
-
});
|
|
28
|
-
}
|
|
44
|
+
return event;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
29
47
|
};
|