Skip to content

Commit fe3bc6e

Browse files
committed
Missing token/apikey error improved for display in Next.js logs
1 parent df138ee commit fe3bc6e

6 files changed

Lines changed: 14 additions & 11 deletions

File tree

.changeset/empty-falcons-run.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@trigger.dev/typeform": patch
3+
"@trigger.dev/github": patch
4+
"@trigger.dev/openai": patch
5+
"@trigger.dev/resend": patch
6+
"@trigger.dev/plain": patch
7+
---
8+
9+
Missing token/apikey error improved for display in Next.js logs

integrations/github/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function createClientFromOptions(
9393
options: GithubIntegrationOptions
9494
): IntegrationClient<Octokit, typeof tasks> {
9595
if (Object.keys(options).includes("token") && !options.token) {
96-
throw new Error(`GitHub integration (${options.id}) token was undefined`);
96+
throw `Can't create GitHub integration (${options.id}) as token was undefined`;
9797
}
9898

9999
if (options.token) {

integrations/openai/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ export class OpenAI
1010

1111
constructor(private options: OpenAIIntegrationOptions) {
1212
if (Object.keys(options).includes("apiKey") && !options.apiKey) {
13-
throw new Error(
14-
`OpenAI integration (${options.id}) apiKey was undefined`
15-
);
13+
throw `Can't create OpenAI integration (${options.id}) as apiKey was undefined`;
1614
}
1715

1816
this.client = {

integrations/plain/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class Plain implements PlainIntegration {
1818

1919
constructor(private options: PlainIntegrationOptions) {
2020
if (Object.keys(options).includes("apiKey") && !options.apiKey) {
21-
throw new Error(`Plain integration (${options.id}) apiKey was undefined`);
21+
throw `Can't create Plain integration (${options.id}) as apiKey was undefined`;
2222
}
2323

2424
this.client = {

integrations/resend/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ export class Resend
5757

5858
constructor(private options: ResendIntegrationOptions) {
5959
if (Object.keys(options).includes("apiKey") && !options.apiKey) {
60-
throw new Error(
61-
`Resend integration (${options.id}) apiKey was undefined`
62-
);
60+
throw `Can't create Resend integration (${options.id}) as apiKey was undefined`;
6361
}
6462

6563
this.client = {

integrations/typeform/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ export class Typeform implements TypeformIntegration {
3535

3636
constructor(private options: TypeformIntegrationOptions) {
3737
if (Object.keys(options).includes("token") && !options.token) {
38-
throw new Error(
39-
`Typeform integration (${options.id}) token was undefined`
40-
);
38+
throw `Can't create Typeform integration (${options.id}) as token was undefined`;
4139
}
4240

4341
this.client = {

0 commit comments

Comments
 (0)