File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1- import crypto , { createHash } from "node:crypto" ;
1+ import crypto from "node:crypto" ;
22import { cacheable , redis } from "@databuddy/redis" ;
33import { captureError } from "@lib/tracing" ;
4+ import { CryptoHasher } from "bun" ;
45
56const EXIT_EVENT_TTL = 172_800 ;
67const STANDARD_EVENT_TTL = 86_400 ;
@@ -40,15 +41,17 @@ export const getDailySalt = cacheable(
4041
4142export function saltAnonymousId ( anonymousId : string , salt : string ) : string {
4243 try {
43- return createHash ( "sha256" )
44- . update ( anonymousId + salt )
45- . digest ( "hex" ) ;
44+ const hasher = new CryptoHasher ( "sha256" ) ;
45+ hasher . update ( anonymousId + salt ) ;
46+ return hasher . digest ( "hex" ) ;
4647 } catch ( error ) {
4748 captureError ( error , {
4849 message : "Failed to salt anonymous ID" ,
4950 anonymousId,
5051 } ) ;
51- return createHash ( "sha256" ) . update ( anonymousId ) . digest ( "hex" ) ;
52+ const fallbackHasher = new CryptoHasher ( "sha256" ) ;
53+ fallbackHasher . update ( anonymousId ) ;
54+ return fallbackHasher . digest ( "hex" ) ;
5255 }
5356}
5457
Original file line number Diff line number Diff line change @@ -17,18 +17,21 @@ COPY packages/ ./packages/
1717RUN bun install
1818
1919COPY apps/basket/src ./apps/basket/src
20+ COPY apps/basket/tsconfig.json ./apps/basket/tsconfig.json
2021
2122ENV NODE_ENV=production
2223
24+ WORKDIR /app/apps/basket
25+
2326RUN bun build \
2427 --compile \
2528 --minify-whitespace \
2629 --minify-syntax \
2730 --target bun \
28- --outfile server \
31+ --outfile /app/ server \
2932 --sourcemap \
3033 --bytecode \
31- ./apps/basket/ src/index.ts
34+ ./src/index.ts
3235
3336FROM gcr.io/distroless/base
3437
You can’t perform that action at this time.
0 commit comments