Skip to content

Commit

Permalink
DPLT-1049 Fix issues with separate user DB provisioning (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgsmccauley authored Jul 21, 2023
1 parent 8e18566 commit b360555
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/deploy-lambdas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion indexer-js-queue-handler/indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down
1 change: 1 addition & 0 deletions indexer-js-queue-handler/indexer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 5 additions & 0 deletions indexer-js-queue-handler/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b360555

Please sign in to comment.