MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / #apiKey

Method #apiKey

packages/trigger-sdk/src/apiClient.ts:696–739  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

694 }
695
696 async #apiKey() {
697 const apiKey = getApiKey(this.#options.apiKey);
698
699 if (apiKey.status === "invalid") {
700 throw new Error("Invalid API key");
701
702 // const chalk = (await import("chalk")).default;
703 // const terminalLink = (await import("terminal-link")).default;
704
705 // throw new Error(
706 // `${chalk.red("Trigger.dev error")}: Invalid API key ("${chalk.italic(
707 // apiKey.apiKey
708 // )}"), please set the TRIGGER_API_KEY environment variable or pass the apiKey option to a valid value. ${terminalLink(
709 // "Get your API key here",
710 // "https://app.trigger.dev",
711 // {
712 // fallback(text, url) {
713 // return `${text} 👉 ${url}`;
714 // },
715 // }
716 // )}`
717 // );
718 } else if (apiKey.status === "missing") {
719 throw new Error("Missing API key");
720 // const chalk = (await import("chalk")).default;
721 // const terminalLink = (await import("terminal-link")).default;
722
723 // throw new Error(
724 // `${chalk.red(
725 // "Trigger.dev error"
726 // )}: Missing an API key, please set the TRIGGER_API_KEY environment variable or pass the apiKey option to the Trigger constructor. ${terminalLink(
727 // "Get your API key here",
728 // "https://app.trigger.dev",
729 // {
730 // fallback(text, url) {
731 // return `${text} 👉 ${url}`;
732 // },
733 // }
734 // )}`
735 // );
736 }
737
738 return apiKey.apiKey;
739 }
740}
741
742function getApiKey(key?: string) {

Callers 15

registerEndpointMethod · 0.95
runTaskMethod · 0.95
completeTaskMethod · 0.95
failTaskMethod · 0.95
sendEventMethod · 0.95
sendEventsMethod · 0.95
cancelEventMethod · 0.95
cancelRunsForEventMethod · 0.95
updateStatusMethod · 0.95
updateSourceMethod · 0.95
updateWebhookMethod · 0.95
registerTriggerMethod · 0.95

Calls 1

getApiKeyFunction · 0.85

Tested by

no test coverage detected