I'm getting an Undefined variable: newWidth when a source image is the same width as the transform I'm requesting.

Use that asset id in place of #### in the GraphQL explorer:
```graphql
query {
asset(id:####) {
w1440: url @transform(width: 1440, immediately: true)
}
}
4. The response (for me at least) should be:
```json
{
"errors": [
{
"debugMessage": "Undefined variable: newWidth",
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"asset",
"w1440"
]
}
],
"data": {
"asset": {
"w1440": null
}
}
}
Please search for that error in storage/logs/ and post the stack trace that follows it.
I ran grep -r "newWidth" storage/logs and I'm not getting any results. Am I approaching this the wrong way?
@weotch I think the GraphQL lib doesn't really log it. I'll see if I can reproduce this in a bit.
By the way, besides showing that error in the response and failing to make the image, it also slows down my graphql query from <1s to >30s.
By the way, besides showing that error in the response and failing to make the image, it also slows down my graphql query from <1s to >30s.
Yeah, transform eager-loading via GraphQL is coming in 3.5.
In 3.4 you can use the withTransforms argument for Assets, but, unfortunately, it only supports named transforms at the time.
I'm getting this bug too (the dimensions of the image that my client has uploaded are the same as the transform and it results in Undefined variable: newWidth), here's my stack trace:
2020-04-02 12:13:52 [-][-][3nnn3dfnoqejmvvk27mm6v4ksb][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined variable: newWidth in /vendor/craftcms/cms/src/image/Raster.php:299
Stack trace:
#0 /vendor/craftcms/cms/src/web/ErrorHandler.php(74): yii\base\ErrorHandler->handleError()
#1 /vendor/craftcms/cms/src/image/Raster.php(299): craft\web\ErrorHandler->handleError()
#2 /vendor/craftcms/cms/src/services/AssetTransforms.php(1436): craft\image\Raster->scaleAndCrop()
#3 /vendor/craftcms/cms/src/services/AssetTransforms.php(701): craft\services\AssetTransforms->_createTransformForAsset()
#4 /vendor/craftcms/cms/src/services/AssetTransforms.php(604): craft\services\AssetTransforms->_generateTransform()
#5 /vendor/craftcms/cms/src/controllers/AssetsController.php(1148): craft\services\AssetTransforms->ensureTransformUrlByIndexModel()
#6 [internal function]: craft\controllers\AssetsController->actionGenerateTransform()
#7 /vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#8 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#9 /vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction()
#10 /vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction()
#11 /vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction()
#12 /vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction()
#13 /vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest()
#14 /vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#15 /public_html/index.php(21): yii\base\Application->run()
#16 {main}
Also, important to note that I have upscaling images set to false ('upscaleImages' => false), and when I comment this out in my config the transform works fine.
This has been fixed for the next release (3120036f0bfee2ff6a4cb2135045ed7be75e4a44).
鈥nd that鈥檚 out now (3.4.13).
Most helpful comment
This has been fixed for the next release (3120036f0bfee2ff6a4cb2135045ed7be75e4a44).