Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Promise functions on BatchTransaction #1899

Open
pequalsnp opened this issue Aug 10, 2023 · 1 comment
Open

Missing Promise functions on BatchTransaction #1899

pequalsnp opened this issue Aug 10, 2023 · 1 comment
Assignees
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@pequalsnp
Copy link

Environment details

  • OS: OSX
  • Node.js version: v18.16.0
  • npm version: 9.5.1
  • @google-cloud/spanner version: 6.12.0

Steps to reproduce

  1. Use Typescript
  2. Attempt to use batch transactions as shown in samples/batch.js
    const query = {
      sql: `
        select
          *
        from
          ${POST_TABLE_NAME}
      `,
    };

    const [transaction] = await this.database.createBatchTransaction();
    const partitions = transaction.createQueryPartitions(query);
  1. Get tsc error:
    domains/archive/post-service/src/post-service-spanner.repository.ts:274:11 - error TS2488: Type 'void' must have a '[Symbol.iterator]()' method that returns an iterator.

    274     const [partitions] = await transaction.createQueryPartitions(query);
                  ~~~~~~~~~~~~
    domains/archive/post-service/src/post-service-spanner.repository.ts:274:44 - error TS2554: Expected 2 arguments, but got 1.

    274     const [partitions] = await transaction.createQueryPartitions(query);
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      node_modules/@google-cloud/spanner/build/src/batch-transaction.d.ts:111:39
        111     createQueryPartitions(query: any, callback: any): void;
                                                  ~~~~~~~~~~~~~
        An argument for 'callback' was not provided.

The problem appears to be that your use of promisifyAll doesn't cause the appropriate method types to be included in the .d.ts file.

@pequalsnp pequalsnp added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 10, 2023
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/nodejs-spanner API. label Aug 10, 2023
@rahul2393
Copy link
Contributor

@surbhigarg92 please help triage this.

@surbhigarg92 surbhigarg92 self-assigned this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants