Add debug message for contentful - ping

This commit is contained in:
Lukasz Ostrowski 2023-05-18 11:07:01 +02:00
parent 7c9a9a2890
commit 99c307d1cb
2 changed files with 3 additions and 4 deletions

View file

@ -96,7 +96,7 @@ const getEntryEndpoint = ({
}): string => `/spaces/${spaceId}/environments/${environment}/entries/${resourceId}`; }): string => `/spaces/${spaceId}/environments/${environment}/entries/${resourceId}`;
const contentfulOperations: CreateOperations<ContentfulConfig> = (config) => { const contentfulOperations: CreateOperations<ContentfulConfig> = (config) => {
const logger = createLogger({ cms: "strapi" }); const logger = createLogger({ cms: "contentful" });
const { environment, spaceId, contentId, locale, apiRequestsPerSecond } = config; const { environment, spaceId, contentId, locale, apiRequestsPerSecond } = config;
@ -105,8 +105,9 @@ const contentfulOperations: CreateOperations<ContentfulConfig> = (config) => {
const pingCMS = async () => { const pingCMS = async () => {
const endpoint = `/spaces/${spaceId}`; const endpoint = `/spaces/${spaceId}`;
const response = await contentfulFetch(endpoint, config, { method: "GET" }); const response = await contentfulFetch(endpoint, config, { method: "GET" });
const respBody = await response.json();
logger.debug({ response }, "pingCMS response"); logger.debug({ response, body: respBody }, "pingCMS response");
return { return {
ok: response.ok, ok: response.ok,
}; };

View file

@ -14,7 +14,6 @@ export interface ProviderInstancePingApiPayload {
export interface ProviderInstancePingApiResponse { export interface ProviderInstancePingApiResponse {
success: boolean; success: boolean;
message?: string;
} }
const handler: NextProtectedApiHandler = async ( const handler: NextProtectedApiHandler = async (
@ -73,7 +72,6 @@ const handler: NextProtectedApiHandler = async (
return res.status(400).json({ return res.status(400).json({
success: false, success: false,
message: JSON.stringify(e),
}); });
} }
}; };