Improved API key error message for SendGrid setup page (#8847)
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
This commit is contained in:
parent
b44e5a7aae
commit
078c9ddca5
|
@ -15,7 +15,13 @@ export async function getHandler(req: NextApiRequest) {
|
|||
const { api_key } = req.body;
|
||||
if (!api_key) throw new HttpError({ statusCode: 400, message: "No Api Key provided to check" });
|
||||
|
||||
const encrypted = symmetricEncrypt(JSON.stringify({ api_key }), process.env.CALENDSO_ENCRYPTION_KEY || "");
|
||||
let encrypted;
|
||||
try {
|
||||
encrypted = symmetricEncrypt(JSON.stringify({ api_key }), process.env.CALENDSO_ENCRYPTION_KEY || "");
|
||||
} catch (reason) {
|
||||
logger.error("Could not add Sendgrid app", reason);
|
||||
throw new HttpError({ statusCode: 500, message: "Invalid length - CALENDSO_ENCRYPTION_KEY" });
|
||||
}
|
||||
|
||||
const data = {
|
||||
type: "sendgrid_other_calendar",
|
||||
|
|
|
@ -84,7 +84,7 @@ export default function SendgridSetup() {
|
|||
onBlur={onBlur}
|
||||
disabled={testPassed === true}
|
||||
name="api_key"
|
||||
placeholder="api_xyz..."
|
||||
placeholder="SG.xxxxxx..."
|
||||
onChange={async (e) => {
|
||||
onChange(e.target.value);
|
||||
form.setValue("api_key", e.target.value);
|
||||
|
|
Loading…
Reference in New Issue
Block a user