craftcms / google-cloud

Google Cloud Storage volume type for Craft CMS.
https://plugins.craftcms.com/google-cloud
MIT License
11 stars 10 forks source link

GraphQL Transforms seem to be unavailable #19

Closed jesuismaxime closed 3 years ago

jesuismaxime commented 3 years ago

Description

It may be more of a question, but image transforms dont seem to be accessible with the plugin (I try only with GraphQL, and yes my volume is available in my Public Schema).

Steps to reproduce

  1. I test this query:
    {
    asset(id: 458) {
    uid
    ...on AssetInterface {
      title
      width
      height
      square: url @ transform (width: 300, height: 300)
    }
    }
    }
  2. And got that result :
    {
    "data": {
    "asset": {
      "uid": "24cfef8f-11f2-4013-9c2b-4073ab6f3d00",
      "title": "Test",
      "width": 498,
      "height": 306,
      "square": null
    }
    }
    }

I tested the query with a local asset id (not handle by GCS) and it works well. Do I need to specify some permissions in GCS to make Craft able to create new sub-folders?

Edit/Update:

I try directly in my index twig template, and with that I was able to have some relevant logs (I add no error logs with the GraphQL query):

Google\Cloud\Core\Exception\BadRequestException: {
  "error": {
    "code": 400,
    "message": "Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access",
    "errors": [
      {
        "message": "Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

I switch back to 'Fine-grained'* and it works fine with Twig, but still have a null with GQL.

*It may be a nice detail to add to the plugin documentation!

Additional info

jesuismaxime commented 3 years ago

Had to explicitly specify the 'mode' within the query to get the url as wanted, example:

{
  asset(id: 458) {
    uid
    ...on AssetInterface {
      title
      width
      height
      square: url @ transform (mode: "crop", width: 300, height: 300)
    }
  }
}

Having a default/fallback mode value as the core Image Transforms component would be great!

andris-sevcenko commented 3 years ago

Related: https://github.com/Superbalist/flysystem-google-cloud-storage/pull/114

andris-sevcenko commented 3 years ago

Actually, image transforms do default to crop, so not sure what happened there. Is this on a public environment where it's possible to get access?