Closed JWURD closed 2 years ago
Was able to solve by changing Dynamic Subfolder Paths profile/ {{ currentUser.id }} to {{id}}
Why would saving the asset to {{ currentUser.id }} fail when attempting to log in via SSO ?
:wave: @JWURD,
Can you help me better understand what is happening when you receive this exception (craft\errors\InvalidSubpathException
)?
It seems like you have a process for users to upload an asset which they must be logged into perform the operation. The exception seems to show that the user is not logged in while trying to upload the asset, the plugin tries to log them in, and then and that is causing this issue.
I assume I'm missing some context (so bare with me here), but can you force the authentication to happen in a separate operation before than the asset upload?
Closing for now. Let me know if you need anything else here.
Having tested this error only occurs while using the SAML Service provider plugin: I have tested in multiple versioning env and experienced the same issue.
I can save an asset file Image or doc while logged in the first time but if I log back into via screen displays a server error and receive the below stack trace. If I remove the asset file I am able to use SSO login again.
Current ENV: Craft Pro 3.7.38 Yii 2.0.45 Twig 2.14.13 SAML Service Provider 2.7.3
Stack Trace: ``022-04-05 16:29:08 [-][-][-][error][craft\errors\InvalidSubpathException] craft\errors\InvalidSubpathException: Could not resolve the subpath “profile/{{currentUser.id}}”. in /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php:820 Stack trace:
0 /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php(910): craft\fields\Assets->_resolveVolumePathToFolderId()
1 /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php(501): craft\fields\Assets->_determineUploadFolderId()
2 /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php(565): craft\fields\Assets->craft\fields{closure}()
3 /home/umhbweb/craft/vendor/craftcms/cms/src/base/Element.php(4142): craft\fields\Assets->afterElementSave()
4 /home/umhbweb/craft/vendor/craftcms/cms/src/elements/User.php(1617): craft\base\Element->afterSave()
5 /home/umhbweb/craft/vendor/craftcms/cms/src/services/Elements.php(2703): craft\elements\User->afterSave()
6 /home/umhbweb/craft/vendor/craftcms/cms/src/services/Elements.php(784): craft\services\Elements->_saveElementInternal()
7 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/services/login/User.php(168): craft\services\Elements->saveElement()
8 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/services/login/User.php(145): flipbox\saml\sp\services\login\User->save()
9 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/services/Login.php(68): flipbox\saml\sp\services\login\User->sync()
10 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/controllers/LoginController.php(118): flipbox\saml\sp\services\Login->transformToUser()
11 [internal function]: flipbox\saml\sp\controllers\LoginController->actionIndex()
12 /home/umhbweb/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
13 /home/umhbweb/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
14 /home/umhbweb/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
15 /home/umhbweb/craft/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction()
16 /home/umhbweb/craft/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction()
17 /home/umhbweb/craft/vendor/craftcms/cms/src/web/Application.php(278): yii\web\Application->handleRequest()
18 /home/umhbweb/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
19 /home/umhbweb/craft/web/index.php(12): yii\base\Application->run()
20 {main}
Next craft\errors\InvalidSubpathException: The Directory Photo field’s Asset Location setting has an invalid subpath (“profile/{{currentUser.id}}”). in /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php:929 Stack trace:
0 /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php(501): craft\fields\Assets->_determineUploadFolderId()
1 /home/umhbweb/craft/vendor/craftcms/cms/src/fields/Assets.php(565): craft\fields\Assets->craft\fields{closure}()
2 /home/umhbweb/craft/vendor/craftcms/cms/src/base/Element.php(4142): craft\fields\Assets->afterElementSave()
3 /home/umhbweb/craft/vendor/craftcms/cms/src/elements/User.php(1617): craft\base\Element->afterSave()
4 /home/umhbweb/craft/vendor/craftcms/cms/src/services/Elements.php(2703): craft\elements\User->afterSave()
5 /home/umhbweb/craft/vendor/craftcms/cms/src/services/Elements.php(784): craft\services\Elements->_saveElementInternal()
6 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/services/login/User.php(168): craft\services\Elements->saveElement()
7 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/services/login/User.php(145): flipbox\saml\sp\services\login\User->save()
8 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/services/Login.php(68): flipbox\saml\sp\services\login\User->sync()
9 /home/umhbweb/craft/vendor/flipboxfactory/saml-sp/src/controllers/LoginController.php(118): flipbox\saml\sp\services\Login->transformToUser()
10 [internal function]: flipbox\saml\sp\controllers\LoginController->actionIndex()
11 /home/umhbweb/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
12 /home/umhbweb/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
13 /home/umhbweb/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
14 /home/umhbweb/craft/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction()
15 /home/umhbweb/craft/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction()
16 /home/umhbweb/craft/vendor/craftcms/cms/src/web/Application.php(278): yii\web\Application->handleRequest()
17 /home/umhbweb/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
18 /home/umhbweb/craft/web/index.php(12): yii\base\Application->run()
19 {main}