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

[Analytics-Admin] WebDataStream is not found in descriptor pool. Only generated classes may derive from Message. #5442

Closed
goodhands opened this issue Aug 7, 2022 · 3 comments
Labels
type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@goodhands
Copy link

Environment details

  • OS: Windows 11
  • PHP version: 7.4.10
  • Package name and version: google/analytics-admin: 0.6.4

Steps to reproduce

  1. Install the analytics-admin package via composer
  2. Attempt to create a WebDataStream

The following code example show how I attempt to create a WebStream

Code example

        use Google\Analytics\Admin\V1alpha\WebDataStream;
        
        $stream = new WebDataStream();

        $stream->setDisplayName("Default web stream");
        $stream->setDefaultUri("https://duxstore.co");

        try {
            $property = $client->propertyName($propertyName); // this works as expected
            return $client->createDataStream($property, $stream); // this throws an exception
        } catch (Exception $e) {
            throw $e;
        }
@vishwarajanand
Copy link
Contributor

Found a duplicate issue here: #5441 which is already closed.

@vishwarajanand vishwarajanand added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Sep 3, 2022
@goodhands
Copy link
Author

The bug is not solved yet, however I get over this error by using WebStreamData this way:

        $webStream = new WebStreamData();
        $webStream->setDefaultUri($url);

        $streamData = new DataStream();
        $streamData->setDisplayName("Default Stream");
        $streamData->setType(1); // Web Stream
        $streamData->setWebStreamData($webStream);

        try {
            $response = $client->createDataStream($propertyName, $streamData);

            $stream = new CreateDataStreamRequest();
            $stream->setDataStream($response);

            return $response;
        } catch (Exception $e) {
            Log::debug("Error occurred while creating a stream");
            throw $e;
        }

@bshaffer
Copy link
Contributor

The reason the first example throws an error is that WebDataStream class has been removed (see googleapis/googleapis@a079cb0). This is an alpha API, so you'll want to update to the latest version, and it's recommended you use v1beta instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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