From 5a65399a597cec67e0c5f2700ba440c63c14b6e1 Mon Sep 17 00:00:00 2001 From: vignesha22 <82584664+vignesha22@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:42:38 +0530 Subject: [PATCH] PRO-2685 - Arka_Error_Handling (#132) * added error handling return messages * updated package version --- backend/package.json | 2 +- backend/src/paymaster/index.ts | 14 +++++++-- backend/src/routes/deposit-route.ts | 8 +++--- backend/src/routes/metadata-routes.ts | 23 ++++++++------- backend/src/routes/paymaster-routes.ts | 17 +++++------ backend/src/routes/whitelist-routes.ts | 40 +++++++++++++------------- 6 files changed, 58 insertions(+), 46 deletions(-) diff --git a/backend/package.json b/backend/package.json index aae7b50..0b62f65 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "arka", - "version": "1.5.0", + "version": "1.5.1", "description": "ARKA - (Albanian for Cashier's case) is the first open source Paymaster as a service software", "type": "module", "directories": { diff --git a/backend/src/paymaster/index.ts b/backend/src/paymaster/index.ts index 315b8a2..00fbb15 100644 --- a/backend/src/paymaster/index.ts +++ b/backend/src/paymaster/index.ts @@ -109,7 +109,9 @@ export class Paymaster { return returnValue; } catch (err: any) { - if (log) log.error(err, 'signv07'); + if (err.message.includes("Quota exceeded")) + throw new Error('Failed to process request to bundler since request Quota exceeded for the current apiKey') + if (log) log.error(err, 'signV07'); throw new Error('Failed to process request to bundler. Please contact support team RawErrorMsg:' + err.message) } } @@ -166,10 +168,12 @@ export class Paymaster { return returnValue; } catch (err: any) { + if (err.message.includes("Quota exceeded")) + throw new Error('Failed to process request to bundler since request Quota exceeded for the current apiKey') if (log) log.error(err, 'signV06'); throw new Error('Failed to process request to bundler. Please contact support team RawErrorMsg:' + err.message) } - } + } async getPaymasterAndDataForMultiTokenPaymaster(userOp: any, validUntil: string, validAfter: string, feeToken: string, ethPrice: string, paymasterContract: Contract, signer: Wallet) { @@ -238,6 +242,8 @@ export class Paymaster { return returnValue; } catch (err: any) { + if (err.message.includes("Quota exceeded")) + throw new Error('Failed to process request to bundler since request Quota exceeded for the current apiKey') if (log) log.error(err, 'signCombinedPaymaster'); throw new Error('Failed to process request to bundler. Please contact support team RawErrorMsg:' + err.message) } @@ -287,6 +293,8 @@ export class Paymaster { callGasLimit: response.callGasLimit, }; } catch (err: any) { + if (err.message.includes("Quota exceeded")) + throw new Error('Failed to process request to bundler since request Quota exceeded for the current apiKey') if (err.message.includes('The required token amount')) throw new Error(err.message); if (log) log.error(err, 'pimlico'); throw new Error('Failed to process request to bundler. Please contact support team RawErrorMsg: ' + err.message) @@ -356,6 +364,8 @@ export class Paymaster { return returnValue; } catch (err: any) { + if (err.message.includes("Quota exceeded")) + throw new Error('Failed to process request to bundler since request Quota exceeded for the current apiKey') if (log) log.error(err, 'ERC20Paymaster'); throw new Error('Failed to process request to bundler. Please contact support team RawErrorMsg:' + err.message) } diff --git a/backend/src/routes/deposit-route.ts b/backend/src/routes/deposit-route.ts index c8ee459..8994192 100644 --- a/backend/src/routes/deposit-route.ts +++ b/backend/src/routes/deposit-route.ts @@ -56,6 +56,8 @@ const depositRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -70,8 +72,6 @@ const depositRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; if (apiKeyEntity.bundlerApiKey) { @@ -117,6 +117,8 @@ const depositRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -131,8 +133,6 @@ const depositRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; if (apiKeyEntity.bundlerApiKey) { diff --git a/backend/src/routes/metadata-routes.ts b/backend/src/routes/metadata-routes.ts index 3e8bc66..824648f 100644 --- a/backend/src/routes/metadata-routes.ts +++ b/backend/src/routes/metadata-routes.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { GetSecretValueCommand, SecretsManagerClient } from "@aws-sdk/client-secrets-manager"; import { FastifyPluginAsync } from "fastify"; import { Contract, Wallet, providers } from "ethers"; @@ -37,13 +38,18 @@ const metadataRoutes: FastifyPluginAsync = async (server) => { if (!api_key) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!chainId) - return reply.code(ReturnCode.FAILURE).send({error: ErrorMessage.INVALID_DATA}) + return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_DATA }) let customPaymasters = []; let multiTokenPaymasters = []; let privateKey = ''; let supportedNetworks; let sponsorName = '', sponsorImage = ''; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) { + server.log.info("Invalid Api Key provided") + return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) + } if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -61,7 +67,7 @@ const metadataRoutes: FastifyPluginAsync = async (server) => { } if (secrets['MULTI_TOKEN_PAYMASTERS']) { const buffer = Buffer.from(secrets['MULTI_TOKEN_PAYMASTERS'], 'base64'); - multiTokenPaymasters = JSON.parse(buffer.toString()); + multiTokenPaymasters = JSON.parse(buffer.toString()); } if (secrets['BUNDLER_API_KEY']) { bundlerApiKey = secrets['BUNDLER_API_KEY']; @@ -71,18 +77,13 @@ const metadataRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) { - server.log.info("Invalid Api Key provided") - return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) - } if (apiKeyEntity.erc20Paymasters) { const buffer = Buffer.from(apiKeyEntity.erc20Paymasters, 'base64'); customPaymasters = JSON.parse(buffer.toString()); } if (apiKeyEntity.multiTokenPaymasters) { const buffer = Buffer.from(apiKeyEntity.multiTokenPaymasters, 'base64'); - multiTokenPaymasters = JSON.parse(buffer.toString()); + multiTokenPaymasters = JSON.parse(buffer.toString()); } if (apiKeyEntity.bundlerApiKey) { bundlerApiKey = apiKeyEntity.bundlerApiKey; @@ -108,16 +109,16 @@ const metadataRoutes: FastifyPluginAsync = async (server) => { const paymasterContract = new Contract(networkConfig.contracts.etherspotPaymasterAddress, EtherspotAbi.default, provider); const sponsorBalance = await paymasterContract.getSponsorBalance(sponsorAddress); - const chainsSupported: {chainId: number, entryPoint: string}[] = []; + const chainsSupported: { chainId: number, entryPoint: string }[] = []; if (supportedNetworks) { const buffer = Buffer.from(supportedNetworks, 'base64'); const SUPPORTED_NETWORKS = JSON.parse(buffer.toString()) SUPPORTED_NETWORKS.map((element: { chainId: number, entryPoint: string }) => { - chainsSupported.push({chainId: element.chainId, entryPoint: element.entryPoint}); + chainsSupported.push({ chainId: element.chainId, entryPoint: element.entryPoint }); }) } else { SupportedNetworks.map(element => { - chainsSupported.push({chainId: element.chainId, entryPoint: element.entryPoint}); + chainsSupported.push({ chainId: element.chainId, entryPoint: element.entryPoint }); }) } const tokenPaymasterAddresses = { diff --git a/backend/src/routes/paymaster-routes.ts b/backend/src/routes/paymaster-routes.ts index 24eedf9..318f246 100644 --- a/backend/src/routes/paymaster-routes.ts +++ b/backend/src/routes/paymaster-routes.ts @@ -90,6 +90,14 @@ const paymasterRoutes: FastifyPluginAsync = async (server) => { let sponsorName = '', sponsorImage = ''; let contractWhitelistMode = false; let bundlerApiKey = api_key; + + const apiKeyEntity = await server.apiKeyRepository.findOneByApiKey(api_key); + + if (!apiKeyEntity) { + server.log.error("APIKey not configured in database") + return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) + } + if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -136,13 +144,6 @@ const paymasterRoutes: FastifyPluginAsync = async (server) => { return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) } - const apiKeyEntity = await server.apiKeyRepository.findOneByApiKey(api_key); - - if (!apiKeyEntity) { - server.log.error("APIKey not configured in database") - return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.API_KEY_NOT_CONFIGURED_IN_DATABASE }) - } - if (apiKeyEntity.erc20Paymasters) { const buffer = Buffer.from(apiKeyEntity.erc20Paymasters, 'base64'); customPaymasters = JSON.parse(buffer.toString()); @@ -327,9 +328,9 @@ const paymasterRoutes: FastifyPluginAsync = async (server) => { return reply.code(ReturnCode.SUCCESS).send({ jsonrpc: body.jsonrpc, id: body.id, result, error: null }) return reply.code(ReturnCode.SUCCESS).send(result); } catch (err: any) { - request.log.error(err); if (err.name == "ResourceNotFoundException") return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }); + request.log.error(err); return reply.code(ReturnCode.FAILURE).send({ error: err.message ?? ErrorMessage.FAILED_TO_PROCESS }); } } diff --git a/backend/src/routes/whitelist-routes.ts b/backend/src/routes/whitelist-routes.ts index 57f2eab..f4469bb 100644 --- a/backend/src/routes/whitelist-routes.ts +++ b/backend/src/routes/whitelist-routes.ts @@ -43,6 +43,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -57,8 +59,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (apiKeyEntity.bundlerApiKey) { bundlerApiKey = apiKeyEntity.bundlerApiKey; } @@ -110,6 +110,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -122,8 +124,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (apiKeyEntity.bundlerApiKey) { bundlerApiKey = apiKeyEntity.bundlerApiKey; } @@ -174,6 +174,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -186,8 +188,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (apiKeyEntity.bundlerApiKey) bundlerApiKey = apiKeyEntity.bundlerApiKey; privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; @@ -236,6 +236,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) let privateKey = ''; let supportedNetworks; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -247,8 +249,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; } @@ -314,6 +314,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) let privateKey = ''; let supportedNetworks; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -325,8 +327,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; } @@ -375,6 +375,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { if (!api_key) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) let privateKey = ''; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -385,8 +387,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { if (!secrets['PRIVATE_KEY']) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = secrets['PRIVATE_KEY']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); } if (!privateKey) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) @@ -453,6 +453,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) let privateKey = ''; let supportedNetworks; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -464,8 +466,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; } @@ -514,6 +514,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -526,8 +528,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (apiKeyEntity.bundlerApiKey) bundlerApiKey = apiKeyEntity.bundlerApiKey; privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; @@ -582,6 +582,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -594,8 +596,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (apiKeyEntity.bundlerApiKey) bundlerApiKey = apiKeyEntity.bundlerApiKey; privateKey = decode(apiKeyEntity.privateKey, server.config.HMAC_SECRET); supportedNetworks = apiKeyEntity.supportedNetworks; @@ -653,6 +653,8 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { let privateKey = ''; let supportedNetworks; let bundlerApiKey = api_key; + const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); + if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (!unsafeMode) { const AWSresponse = await client.send( new GetSecretValueCommand({ @@ -667,8 +669,6 @@ const whitelistRoutes: FastifyPluginAsync = async (server) => { privateKey = secrets['PRIVATE_KEY']; supportedNetworks = secrets['SUPPORTED_NETWORKS']; } else { - const apiKeyEntity: APIKey | null = await server.apiKeyRepository.findOneByApiKey(api_key); - if (!apiKeyEntity) return reply.code(ReturnCode.FAILURE).send({ error: ErrorMessage.INVALID_API_KEY }) if (apiKeyEntity.bundlerApiKey) { bundlerApiKey = apiKeyEntity.bundlerApiKey; }