Skip to content

Instantly share code, notes, and snippets.

@ljobse
ljobse / mastraSentry.ts
Created March 14, 2025 10:38
Mastra sentry error - TypeError: b.setEntry is not a function
import { createOpenAI } from '@ai-sdk/openai';
import { Agent, Mastra } from '@mastra/core';
import * as Sentry from '@sentry/node';
import { z } from 'zod';
Sentry.init({
dsn: 'xxx', // Replace with your actual Sentry DSN
tracesSampleRate: 1.0, // Capture 100% of transactions for performance monitoring
});
import { ClassTransformer, ClassTransformOptions } from 'class-transformer';
import { ClassType } from 'class-transformer/ClassTransformer';
import { TransformationType, TransformOperationExecutor } from 'class-transformer/TransformOperationExecutor';
import { getFromContainer, MetadataStorage, ValidationTypes } from 'class-validator';
const strip = (container: MetadataStorage, type: new () => any, input: any) => {
const metadata = container.getTargetValidationMetadatas(type, undefined);
const groupedMetadata = container.groupByPropertyName(metadata);
const metadataPropertyKeys = Object.keys(groupedMetadata);
const inputPropertyKeys = Object.keys(input);