fix: missing types in app build (#905)

bonus adjust logging (otel config + exception)
This commit is contained in:
Warren 2025-06-03 13:20:56 -07:00 committed by GitHub
parent 8874648947
commit ab387e1168
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 16 deletions

View file

@ -0,0 +1,7 @@
---
"@hyperdx/common-utils": patch
"@hyperdx/api": patch
"@hyperdx/app": patch
---
fix: missing types in app build

View file

@ -45,6 +45,7 @@ COPY --from=app ./src ./packages/app/src
COPY --from=app ./pages ./packages/app/pages
COPY --from=app ./public ./packages/app/public
COPY --from=app ./styles ./packages/app/styles
COPY --from=app ./types ./packages/app/types
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_OUTPUT_STANDALONE false

View file

@ -11,9 +11,7 @@ export const appErrorHandler = (
res: Response,
next: NextFunction,
) => {
if (!IS_PROD) {
console.error(err);
}
console.error(err);
const userFacingErrorMessage = isOperationalError(err)
? err.name || err.message

View file

@ -1,5 +1,6 @@
import { Request, Response } from 'express';
import * as config from '@/config';
import { getTeam } from '@/controllers/team';
import logger from '@/utils/logger';
@ -109,12 +110,12 @@ export class OpampController {
},
},
};
let config = NOP_CONFIG;
let otelCollectorConfig = NOP_CONFIG;
// If team is not found, don't send a remoteConfig, we aren't ready
// to collect telemetry yet
if (team) {
config = {
otelCollectorConfig = {
extensions: {},
receivers: {
'otlp/hyperdx': {
@ -153,29 +154,37 @@ export class OpampController {
if (team.collectorAuthenticationEnforced) {
const ingestionKey = team.apiKey;
if (config.receivers['otlp/hyperdx'] == null) {
if (otelCollectorConfig.receivers['otlp/hyperdx'] == null) {
// should never happen
throw new Error('otlp/hyperdx receiver not found');
}
config.extensions['bearertokenauth/hyperdx'] = {
otelCollectorConfig.extensions['bearertokenauth/hyperdx'] = {
scheme: '',
tokens: [ingestionKey],
};
config.receivers['otlp/hyperdx'].protocols.grpc.auth = {
authenticator: 'bearertokenauth/hyperdx',
};
config.receivers['otlp/hyperdx'].protocols.http.auth = {
authenticator: 'bearertokenauth/hyperdx',
};
config.service.extensions = ['bearertokenauth/hyperdx'];
otelCollectorConfig.receivers['otlp/hyperdx'].protocols.grpc.auth =
{
authenticator: 'bearertokenauth/hyperdx',
};
otelCollectorConfig.receivers['otlp/hyperdx'].protocols.http.auth =
{
authenticator: 'bearertokenauth/hyperdx',
};
otelCollectorConfig.service.extensions = [
'bearertokenauth/hyperdx',
];
}
}
console.log(JSON.stringify(config, null, 2));
if (config.IS_DEV) {
console.log(JSON.stringify(otelCollectorConfig, null, 2));
}
const remoteConfig = createRemoteConfig(
new Map([['config.json', Buffer.from(JSON.stringify(config))]]),
new Map([
['config.json', Buffer.from(JSON.stringify(otelCollectorConfig))],
]),
'application/json',
);

View file

@ -36,6 +36,7 @@ COPY ./packages/app/src ./packages/app/src
COPY ./packages/app/pages ./packages/app/pages
COPY ./packages/app/public ./packages/app/public
COPY ./packages/app/styles ./packages/app/styles
COPY ./packages/app/types ./packages/app/types
RUN npx nx run-many --target=build --projects=@hyperdx/common-utils,@hyperdx/app
RUN rm -rf node_modules && yarn workspaces focus @hyperdx/app --production