Missing token/apikey error improved for display in Next.js logs

This commit is contained in:
Matt Aitken
2023-07-13 16:35:21 +01:00
parent df138ee96e
commit fe3bc6efe4
6 changed files with 14 additions and 11 deletions
+9
View File
@@ -0,0 +1,9 @@
---
"@trigger.dev/typeform": patch
"@trigger.dev/github": patch
"@trigger.dev/openai": patch
"@trigger.dev/resend": patch
"@trigger.dev/plain": patch
---
Missing token/apikey error improved for display in Next.js logs
+1 -1
View File
@@ -93,7 +93,7 @@ function createClientFromOptions(
options: GithubIntegrationOptions options: GithubIntegrationOptions
): IntegrationClient<Octokit, typeof tasks> { ): IntegrationClient<Octokit, typeof tasks> {
if (Object.keys(options).includes("token") && !options.token) { if (Object.keys(options).includes("token") && !options.token) {
throw new Error(`GitHub integration (${options.id}) token was undefined`); throw `Can't create GitHub integration (${options.id}) as token was undefined`;
} }
if (options.token) { if (options.token) {
+1 -3
View File
@@ -10,9 +10,7 @@ export class OpenAI
constructor(private options: OpenAIIntegrationOptions) { constructor(private options: OpenAIIntegrationOptions) {
if (Object.keys(options).includes("apiKey") && !options.apiKey) { if (Object.keys(options).includes("apiKey") && !options.apiKey) {
throw new Error( throw `Can't create OpenAI integration (${options.id}) as apiKey was undefined`;
`OpenAI integration (${options.id}) apiKey was undefined`
);
} }
this.client = { this.client = {
+1 -1
View File
@@ -18,7 +18,7 @@ export class Plain implements PlainIntegration {
constructor(private options: PlainIntegrationOptions) { constructor(private options: PlainIntegrationOptions) {
if (Object.keys(options).includes("apiKey") && !options.apiKey) { if (Object.keys(options).includes("apiKey") && !options.apiKey) {
throw new Error(`Plain integration (${options.id}) apiKey was undefined`); throw `Can't create Plain integration (${options.id}) as apiKey was undefined`;
} }
this.client = { this.client = {
+1 -3
View File
@@ -57,9 +57,7 @@ export class Resend
constructor(private options: ResendIntegrationOptions) { constructor(private options: ResendIntegrationOptions) {
if (Object.keys(options).includes("apiKey") && !options.apiKey) { if (Object.keys(options).includes("apiKey") && !options.apiKey) {
throw new Error( throw `Can't create Resend integration (${options.id}) as apiKey was undefined`;
`Resend integration (${options.id}) apiKey was undefined`
);
} }
this.client = { this.client = {
+1 -3
View File
@@ -35,9 +35,7 @@ export class Typeform implements TypeformIntegration {
constructor(private options: TypeformIntegrationOptions) { constructor(private options: TypeformIntegrationOptions) {
if (Object.keys(options).includes("token") && !options.token) { if (Object.keys(options).includes("token") && !options.token) {
throw new Error( throw `Can't create Typeform integration (${options.id}) as token was undefined`;
`Typeform integration (${options.id}) token was undefined`
);
} }
this.client = { this.client = {