From 40f4aaad5b45964689bc728416895cc27ac22334 Mon Sep 17 00:00:00 2001 From: Morgan Mccauley Date: Fri, 21 Jul 2023 14:14:01 +1200 Subject: [PATCH 1/2] fix: Add missing argument --- indexer-js-queue-handler/indexer.js | 2 +- indexer-js-queue-handler/indexer.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/indexer-js-queue-handler/indexer.js b/indexer-js-queue-handler/indexer.js index ef5f3a0bf..8103ff6e1 100644 --- a/indexer-js-queue-handler/indexer.js +++ b/indexer-js-queue-handler/indexer.js @@ -53,7 +53,7 @@ export default class Indexer { if (options.provision && !indexerFunction["provisioned"]) { try { - if (!await this.deps.provisioner.isUserApiProvisioned(indexerFunction.account_id)) { + if (!await this.deps.provisioner.isUserApiProvisioned(indexerFunction.account_id, indexerFunction.function_name)) { await this.setStatus(function_name, block_height, 'PROVISIONING'); simultaneousPromises.push(this.writeLog(function_name, block_height, 'Provisioning endpoint: starting')); diff --git a/indexer-js-queue-handler/indexer.test.js b/indexer-js-queue-handler/indexer.test.js index c59315455..18322215e 100644 --- a/indexer-js-queue-handler/indexer.test.js +++ b/indexer-js-queue-handler/indexer.test.js @@ -604,6 +604,7 @@ mutation _1 { set(functionName: "buildnear.testnet/test", key: "foo2", data: "in }; await indexer.runFunctions(1, functions, false, { provision: true }); + expect(provisioner.isUserApiProvisioned).toHaveBeenCalledWith('morgs.near', 'test'); expect(provisioner.provisionUserApi).toHaveBeenCalledTimes(1); expect(provisioner.provisionUserApi).toHaveBeenCalledWith( 'morgs.near', From 116e1a2d7ba3af7f3644b2736d243bbe0280e770 Mon Sep 17 00:00:00 2001 From: Morgan Mccauley Date: Fri, 21 Jul 2023 14:14:10 +1200 Subject: [PATCH 2/2] fix: Add PG environment variables to serverless deployment --- .github/workflows/deploy-lambdas.yml | 5 +++++ indexer-js-queue-handler/serverless.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/deploy-lambdas.yml b/.github/workflows/deploy-lambdas.yml index 8ea809fb6..5a8879a12 100644 --- a/.github/workflows/deploy-lambdas.yml +++ b/.github/workflows/deploy-lambdas.yml @@ -37,3 +37,8 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} HASURA_ENDPOINT: ${{ vars.HASURA_ENDPOINT }} HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }} + PG_ADMIN_USER: ${{ secrets.PG_ADMIN_USER }} + PG_ADMIN_PASSWORD: ${{ secrets.PG_ADMIN_PASSWORD }} + PG_ADMIN_DATABASE: ${{ secrets.PG_ADMIN_DATABASE }} + PG_HOST: ${{ secrets.PG_HOST }} + PG_PORT: ${{ secrets.PG_PORT }} diff --git a/indexer-js-queue-handler/serverless.yml b/indexer-js-queue-handler/serverless.yml index 368400cc7..a7fb8c188 100644 --- a/indexer-js-queue-handler/serverless.yml +++ b/indexer-js-queue-handler/serverless.yml @@ -13,6 +13,11 @@ provider: STAGE: ${opt:stage, 'dev'} HASURA_ENDPOINT: ${env:HASURA_ENDPOINT} HASURA_ADMIN_SECRET: ${env:HASURA_ADMIN_SECRET} + PG_ADMIN_USER: ${env:PG_ADMIN_USER} + PG_ADMIN_PASSWORD: ${env:PG_ADMIN_PASSWORD} + PG_ADMIN_DATABASE: ${env:PG_ADMIN_DATABASE} + PG_HOST: ${env:PG_HOST} + PG_PORT: ${env:PG_PORT} tracing: lambda: true #enable X-Ray tracing iamRoleStatements: