beam icon indicating copy to clipboard operation
beam copied to clipboard

[Bug]: Can't build and deploy dataflow-runner with readFromPubSubWithAttributes (but can with readFromPubSub)

Open denis-haskin-elemental opened this issue 11 months ago • 3 comments

What happened?

I have a trivial example in Typescript, reading from a PubSub subscription and just logging output. It works fine with readFromPubSub, e.g.

      const messages = await root.applyAsync(
        beam.readFromPubSub({
          subscription: 'subscriptionname',
        })
      );
...etc...

However, when I try switching to readFromPubSubWithAttributes it fails when trying to prepare to deploy. Example code snippet:

      const messages = await root.applyAsync(
        beam.readFromPubSubWithAttributes({
          subscription: 'subscriptionname,
        })
      );

The error:

TypeError: Channel credentials must be a ChannelCredentials object

full log in attached file t.log

I tried also installing @google-cloud/pubsub so I could get typing for the PubsubMessage, but that didn't seem to have any effect (at first I thought maybe that library was interfering with beam's imports).

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • [ ] Component: Python SDK
  • [ ] Component: Java SDK
  • [ ] Component: Go SDK
  • [x] Component: Typescript SDK
  • [ ] Component: IO connector
  • [ ] Component: Beam YAML
  • [ ] Component: Beam examples
  • [ ] Component: Beam playground
  • [ ] Component: Beam katas
  • [ ] Component: Website
  • [ ] Component: Infrastructure
  • [ ] Component: Spark Runner
  • [ ] Component: Flink Runner
  • [ ] Component: Samza Runner
  • [ ] Component: Twister2 Runner
  • [ ] Component: Hazelcast Jet Runner
  • [x] Component: Google Cloud Dataflow Runner

denis-haskin-elemental avatar Jan 13 '25 22:01 denis-haskin-elemental

I wonder if this may be a Typescript configuration issue. I'm not an expert here. Here's my tsconfig (and in my test code I'm doing all my imports with import):

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "outDir": "dist/"    
  },
  "include": ["src/**/*"]
}

denis-haskin-elemental avatar Jan 14 '25 13:01 denis-haskin-elemental

Some additional information. I don't think it's Typescript config.

I did suspect version skew between modules apache-beam was expecting vs. what I was also installing. So I've made all the versions very explicit, to match what apache-beam was requiring. I think that has me past the ChannelCredential error, and now it fails with:

Error: java.lang.RuntimeException: Failed to get dependencies of beam:transform:org.apache.beam:pubsub_read:v1 from spec urn: "beam:transform:org.apache.beam:pubsub_read:v1"
payload: "\nU\n\027\n\017needsAttributes\032\004\b\001\020\b\n\024\n\fsubscription\032\004\b\001\020\a\022$ad987929-9472-471f-9a49-404644636647\022/\002\000\001+projects/foo/subscriptions/me-test-1"

Full output attached (2.log) as well as my package.json and tsconfig.json (just in case)

2.log package.json tsconfig.json

denis-haskin-elemental avatar Jan 14 '25 16:01 denis-haskin-elemental

This issue has been marked as stale due to 150 days of inactivity. It will be closed in 30 days if no further activity occurs. If you think that’s incorrect or this issue still needs to be addressed, please simply write any comment. If closed, you can reopen the issue at any time. Thank you for your contributions.

github-actions[bot] avatar Jun 14 '25 12:06 github-actions[bot]

This issue has been closed due to lack of activity. If you think that is incorrect, you can reopen the issue at any time.

github-actions[bot] avatar Jul 14 '25 12:07 github-actions[bot]