Improve debug logs in createAppRegisterHandler (#231)

This commit is contained in:
Lukasz Ostrowski 2023-04-17 15:11:24 +02:00 committed by GitHub
parent a7cad6a3ec
commit 7c6c164a92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"@saleor/app-sdk": patch
---
Improved and fixed debug logs in createAppRegistedHandler

View file

@ -155,12 +155,15 @@ export const createAppRegisterHandler = ({
} }
if (!validateAllowSaleorUrls(saleorApiUrl, allowedSaleorUrls)) { if (!validateAllowSaleorUrls(saleorApiUrl, allowedSaleorUrls)) {
debug("Validation of URL %s against allowSaleorUrls param resolves to false, throwing"); debug(
"Validation of URL %s against allowSaleorUrls param resolves to false, throwing",
saleorApiUrl
);
return Response.Forbidden( return Response.Forbidden(
createRegisterHandlerResponseBody(false, { createRegisterHandlerResponseBody(false, {
code: "SALEOR_URL_PROHIBITED", code: "SALEOR_URL_PROHIBITED",
message: "This app expects to be installed only in allowed saleor instances", message: "This app expects to be installed only in allowed Saleor instances",
}) })
); );
} }
@ -188,7 +191,7 @@ export const createAppRegisterHandler = ({
createRegisterHandlerResponseBody(false, { createRegisterHandlerResponseBody(false, {
code: "UNKNOWN_APP_ID", code: "UNKNOWN_APP_ID",
message: message:
"The auth data given during registration request could not be used to fetch app ID.", "The auth data given during registration request could not be used to fetch app ID. This usually means that App could not connect to Saleor during installation",
}), }),
{ {
status: 401, status: 401,