Dtuber - Upload to YouTube field can't be created

Created on 3 June 2020, over 4 years ago
Updated 18 March 2023, over 1 year ago

I have added credentials also tested video to upload. Everything is working fine but when I create field I face below error
There was a problem creating field video upload: You have requested a non-existent service "dtuber.settings".
When I edit that field I get
TypeError: Argument 1 passed to Drupal\dtuber\Plugin\Field\FieldType\DtuberField::__construct() must implement interface Drupal\Core\Messenger\MessengerInterface, instance of Drupal\Core\Field\TypedData\FieldItemDataDefinition given, called in C:\xampp\htdocs\vimeo\core\lib\Drupal\Core\TypedData\TypedData.php on line 47 in Drupal\dtuber\Plugin\Field\FieldType\DtuberField->__construct() (line 34 of modules\dtuber\src\Plugin\Field\FieldType\DtuberField.php).

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇵🇰Pakistan riazsaid15 Office E-14, 4th Floor New spinzer IT Plaza next to Gul Haji Plaza, University Road, Peshawar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France liliplanet Cannes

    Exactly same issue, would most appreciate support please.

  • 🇫🇷France liliplanet Cannes

    On adding Dtuber field to a content type, receive the following:

    TypeError: Drupal\dtuber\Plugin\Field\FieldType\DtuberField::__construct(): Argument #1 ($messenger) must be of type Drupal\Core\Messenger\MessengerInterface, Drupal\Core\Field\TypedData\FieldItemDataDefinition given, called in /home/mysite/public_html/core/lib/Drupal/Core/TypedData/TypedData.php on line 47 in Drupal\dtuber\Plugin\Field\FieldType\DtuberField->__construct() (line 36 of /home/mysite/public_html/modules/contrib/dtuber/src/Plugin/Field/FieldType/DtuberField.php)

    Please would you be so kind to fix 🌷

    • JayKandari committed 1ca1c797 on 2.0.x
      Issue #3145179: Dtuber - Upload to YouTube field can't be created
      
  • 🇮🇳India JayKandari

    Thanks! @Liliplanet for reporting this issue. I've pushed a small changes to 2.0.x. Could you pls retest the scenario with latest dev release of 2.0.x branch ?

    If all goes well will create a new release containing this change.

    Thanks!

  • Status changed to Needs review over 1 year ago
  • 🇫🇷France liliplanet Cannes

    Thank you for your response JayKandari!

    First the good news. Test at admin/config/media/dtuber/test works and the video gets uploaded, hurrah 😁

    But after you add a dtuber_field to content type, add node, upload video, you get ..

    edit?_wrapper_format=drupal_ajax&ajax_form=1&destination=%2Fadmin%2Fcontent&element_parents=field_youtube%2Fwidget%2F0%2Ffid

    File does not upload, and get the following error in dblog:

    TypeError: array_unshift(): Argument #1 ($array) must be of type array, string given in array_unshift() (line 253 of /home/mysite/public_html/core/modules/file/file.module)

    One step closer!

    Questions:

    1. Is it possible to upload to a specific folder / playlist on YouTube please?
    2. I see description and tags are available at dtuber/test, will it be available on the field please?
    3. Is it possible to set permissions: private, unlisted, public please?
    4. What about Manage Display? I'm using HTML5 Video

    Most most appreciated JayKandari, so excited and thankful, love to make this work 🌷

  • Status changed to Fixed over 1 year ago
  • 🇮🇳India JayKandari

    Hi @Liliplanet,

    I've just pushed a minor fix to the mentioned issue
    TypeError: array_unshift(): Argument #1 ($array) must be of type array, string given in array_unshift() (line 253 of /home/mysite/public_html/core/modules/file/file.module)

    I will be creating a new release with these changes 2.0.1 Please upgrade to the latest release.

    Also, thank you for the suggestions. But I feel those can be tackled in separate issues. Currently the module is bare minimum and lacks many of the mentioned features. I would like to add those. Let us discuss this in a separate ticket?

    As for this ticket marking it as Fixed.

    Thank you !!

  • 🇫🇷France liliplanet Cannes

    Oh JayKandari, sorry, but dtuber_field does not upload to youtube, you get :

    An error occured, try again later.

    and video is not available on youtube.

    So close 😁 most appreciate your support 🌷

  • Status changed to Active over 1 year ago
  • 🇫🇷France liliplanet Cannes

    I believe this is the answer to Dtuber Error : refresh token must be passed in or set as part of setAccessToken

    https://stackoverflow.com/questions/45760765/refresh-token-must-be-passe...

    You need to set these 2 things. The refresh token is not returned because we didn't force the approvalPrompt. The offline mode is not enough. We must force the approvalPrompt. Also, the redirect URI must be set before these two options. It worked for me.

    $client = new Google_Client();
    $client->setApplicationName('Project Name');
    $client->setScopes('SCOPES');
    $client->setAuthConfig('JSON_FILE_PATH');
    $client->setRedirectUri($this->redirectUri);
    $client->setAccessType('offline');  //this line is magic point
    $client->setApprovalPrompt('force'); //this line is magic point
  • 🇮🇳India JayKandari

    Hi @Lilian,

    Thanks but I am unable to reproduce this error:

    Dtuber Error : refresh token must be passed in or set as part of setAccessToken
    

    The suggested code is already present in the module. I tried removing the refresh_token and access_token from configs and was not able to reproduce this exact error. Do you mind sharing all the steps to reproduce this?
    Created a separate ticket for tracking this -> https://www.drupal.org/project/dtuber/issues/3347604 🐛 Dtuber Error : refresh token must be passed in or set as part of setAccessToken Active

    Or maybe you can try to deauthorize the authentication and reauthorise from this config page (under "Google Authentication" section) -> /admin/config/media/dtuber and then try again to create a new content with the video?

    Thanks!

  • 🇮🇳India JayKandari

    Update:
    I've fixed a change containing refreshing of access and refresh token. Also moved that data from config to state, because this will cause issues during every deployment. Thus.
    ticket for ref - https://www.drupal.org/project/dtuber/issues/3347609 🐛 access_token & refresh_token shouldn't be tracked in config move to state Fixed

    @Liliplanet : can you pls test with latest 2.0.x dev release once see if that error is still reproducible?
    Thanks!

  • 🇫🇷France liliplanet Cannes

    Thank you for the update Jay!

    Unfortunately getting the following:

    Dtuber Error : { "error": { "code": 400, "message": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'.", "errors": [ @ "message": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'.", "reason": "invalid" ], "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ @ "field": "resource", "description": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'." ] } ] } }

  • 🇫🇷France liliplanet Cannes

    Gosh Jay, I'm searching for the answer, if you maybe could point me in the right direction how I can fix this bug, as do not see

    Cannot bind a list to map for field 'localizations

    at https://cloud.google.com/resource-manager/docs/core_errors, don't know what that means 😊

    Your support is most appreciated.

  • 🇫🇷France liliplanet Cannes

    Do we perhaps have any news please Jay?

  • 🇮🇳India JayKandari

    Hi @Liliplanet,
    Thanks for reporting the error. It would help if you can also share the steps you took to reproduce thsi error.
    As for the error code, since it is 400, then it means something wrong information is being sent to the youtube servers, thus that error.

    For me, If I am trying to upload a video by the Test uploader or via the field, both are suceeding.
    Can you try deauthorising the youtube account or maybe use another youtube account for testing?
    I guess the problem could also be around the application setup on google console. maybe try that?

    Thanks!

  • 🇫🇷France liliplanet Cannes

    Hi Jay, thank you for the response. I re-installed the whole process from the beginning, and ..

    Dtuber Error : { "error": { "code": 400, "message": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'.", "errors": [ @ "message": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'.", "reason": "invalid" ], "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ @ "field": "resource", "description": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'." ] } ] } }

    In doing research, the following comes up:

    https://stackoverflow.com/questions/74258331/error-when-writing-to-fires...

    https://github.com/kainxspirits/laravel-pubsub-queue/issues/4

    This is likely due to a bug in the underlying library, which probably sees the empty array passed to pushRaw, and fails to convert it to a map for the request.

    However, this can be worked around by leaving out the attributes if the array is empty. pushRaw would then read:

    Do not add attributes to push when none are passed

  • 🇫🇷France liliplanet Cannes

    Hi again Jay, as you saw in #9 the admin/config/media/dtuber/test worked, so my setup is correct and no issues at the google console.

    Only when you committed new versions, which I truly appreciate, but now it's different errors if you see the posts to you for the past 10 days.

    Please Jay, if you not going to fix the bugs, would you please let me know?

    As I am in a holding pattern here, waiting for you and if it's not going to get fixed, I need to find another solution, time has running out, my presentation is on Monday.

    But your module DTuber would have been perfect 😁

  • 🇫🇷France liliplanet Cannes

    Hi Jay, I saw there was an updated version 2.0.3, so started again,

    1. composer require 'drupal/dtuber:^2.0'
    2. composer require google/apiclient:^2.0
    3. copied google from vendor to modules folder.

    Google Authentication: Authorized

    Try to upload video at admin/config/media/dtuber/test

    result:

    Dtuber Error : { "error": { "code": 400, "message": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'.", "errors": [ @ "message": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'.", "reason": "invalid" ], "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ @ "field": "resource", "description": "Invalid value at 'resource' (Map), Cannot bind a list to map for field 'localizations'." ] } ] } }

Production build 0.71.5 2024