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

Sendout not saving (postgres related ?) #128

Closed
bartroelands opened this issue Apr 10, 2020 · 5 comments
Closed

Sendout not saving (postgres related ?) #128

bartroelands opened this issue Apr 10, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@bartroelands
Copy link

Hi,

Possibly ran into new postrgres related bug. I set up a test campaign and mailing list. When I create a new sendout manually the first time could go to save and preview. When I tried to edit and save again got an validation error. Found in the web.log the following error:

2020-04-10 15:05:23 [-][1][-][info][craft\services\Elements::_saveElementInternal] Element not saved due to validation error: Array
(
    [sid] => Array
        (
            [0] => Sid should contain at most 32 characters.
        )

)

Below screenshot of database entry postgres db

image

Versions

  • Plugin version: 1.14.5
  • Craft version: Craft Pro 3.4.15
@bartroelands bartroelands added the bug Something isn't working label Apr 10, 2020
@bencroker
Copy link
Collaborator

It looks like a bunch of spaces are added to the end of the SID. Can you try changing the SID column to char(32) and see if that helps?

@bartroelands
Copy link
Author

that helped was able to send out and got again a save error in the CP ... web.log below

`2020-04-10 20:27:26 [-][1][9r0trgmslupvefalfrcet4scr3][error][yii\db\Exception] PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column "contactid" does not exist
LINE 7: ...JOIN "campaign_contacts" "contact" ON contact.id = contactId
^
HINT: Perhaps you meant to reference the column "0.contactId". in /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php:1293
Stack trace:
#0 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(1293): PDOStatement->execute()
#1 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT "contact...')
#2 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(444): yii\db\Command->queryInternal('fetchAll', 7)
#3 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Query.php(307): yii\db\Command->queryColumn()
#4 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/services/SendoutsService.php(189): yii\db\Query->column()
#5 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(767): putyourlightson\campaign\services\SendoutsService->getPendingRecipients(Object(putyourlightson\campaign\elements\SendoutElement))
#6 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(779): putyourlightson\campaign\elements\SendoutElement->getPendingRecipients()
#7 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/controllers/SendoutsController.php(112): putyourlightson\campaign\elements\SendoutElement->getPendingRecipientCount()
#8 [internal function]: putyourlightson\campaign\controllers\SendoutsController->actionGetPendingRecipientCount()
#9 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('get-pending-rec...', Array)
#12 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('get-pending-rec...', Array)
#13 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('campaign/sendou...', Array)
#14 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('campaign/sendou...', Array)
#15 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /Users/Bart/Development/psychologennet-portal-1.0/web/index.php(21): yii\base\Application->run()
#18 {main}

Next yii\db\Exception: SQLSTATE[42703]: Undefined column: 7 ERROR: column "contactid" does not exist
LINE 7: ...JOIN "campaign_contacts" "contact" ON contact.id = contactId
^
HINT: Perhaps you meant to reference the column "0.contactId".
The SQL being executed was: SELECT "contactId", min(mailingListId) AS "mailingListId", min(subscribed) AS "subscribed"
FROM (SELECT "campaign_contacts_mailinglists".*
FROM "campaign_contacts_mailinglists"
INNER JOIN "elements" "contactElement" ON "contactElement"."id" = "contactId"
INNER JOIN "elements" "mailingListElement" ON "mailingListElement"."id" = "mailingListId"
WHERE ("contactElement"."dateDeleted" IS NULL) AND ("mailingListElement"."dateDeleted" IS NULL)) "0"
INNER JOIN "campaign_contacts" "contact" ON contact.id = contactId
WHERE (("mailingListId"='1510') AND ("subscriptionStatus"='subscribed')) AND (("contact"."complained" IS NULL) AND ("contact"."bounced" IS NULL)) AND (NOT ("contactId" IN (SELECT "contactId"
FROM (SELECT "campaign_contacts_mailinglists".*
FROM "campaign_contacts_mailinglists"
INNER JOIN "elements" "contactElement" ON "contactElement"."id" = "contactId"
INNER JOIN "elements" "mailingListElement" ON "mailingListElement"."id" = "mailingListId"
WHERE ("contactElement"."dateDeleted" IS NULL) AND ("mailingListElement"."dateDeleted" IS NULL)) "0"
WHERE (0=1) AND ("subscriptionStatus"='subscribed')))) AND (NOT ("contactId" IN (SELECT "contactId"
FROM "campaign_contacts_campaigns"
INNER JOIN "elements" "contactElement" ON "contactElement"."id" = "contactId"
INNER JOIN "elements" "campaignElement" ON "campaignElement"."id" = "campaignId"
WHERE ("sendoutId"=1512) AND (NOT ("sent" IS NULL)))))
GROUP BY "contactId" in /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Schema.php:674
Stack trace:
#0 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'SELECT "contact...')
#1 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT "contact...')
#2 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(444): yii\db\Command->queryInternal('fetchAll', 7)
#3 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Query.php(307): yii\db\Command->queryColumn()
#4 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/services/SendoutsService.php(189): yii\db\Query->column()
#5 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(767): putyourlightson\campaign\services\SendoutsService->getPendingRecipients(Object(putyourlightson\campaign\elements\SendoutElement))
#6 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(779): putyourlightson\campaign\elements\SendoutElement->getPendingRecipients()
#7 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/controllers/SendoutsController.php(112): putyourlightson\campaign\elements\SendoutElement->getPendingRecipientCount()
#8 [internal function]: putyourlightson\campaign\controllers\SendoutsController->actionGetPendingRecipientCount()
#9 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('get-pending-rec...', Array)
#12 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('get-pending-rec...', Array)
#13 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('campaign/sendou...', Array)
#14 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('campaign/sendou...', Array)
#15 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /Users/Bart/Development/psychologennet-portal-1.0/web/index.php(21): yii\base\Application->run()
#18 {main}
Additional Information:
Array
(
[0] => 42703
[1] => 7
[2] => ERROR: column "contactid" does not exist
LINE 7: ...JOIN "campaign_contacts" "contact" ON contact.id = contactId
^
HINT: Perhaps you meant to reference the column "0.contactId".
)

2020-04-10 20:27:25 [-][1][9r0trgmslupvefalfrcet4scr3][info][application] $_GET = [
'p' => 'beheersconsole/actions/campaign/sendouts/get-pending-recipient-count'
'sendoutId' => '1512'
]

$_POST = []
`

@bartroelands
Copy link
Author

The sendout dit also not generate the file in storage/runtime/debug/mail (in test mode). Got now an server error messages in CP , if I select sendouts ... web.log ->

`LINE 7: ...JOIN "campaign_contacts" "contact" ON contact.id = contactId
^
HINT: Perhaps you meant to reference the column "0.contactId". in /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php:1293
Stack trace:
#0 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(1293): PDOStatement->execute()
#1 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT "contact...')
#2 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Command.php(444): yii\db\Command->queryInternal('fetchAll', 7)
#3 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/db/Query.php(307): yii\db\Command->queryColumn()
#4 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/services/SendoutsService.php(189): yii\db\Query->column()
#5 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(767): putyourlightson\campaign\services\SendoutsService->getPendingRecipients(Object(putyourlightson\campaign\elements\SendoutElement))
#6 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(779): putyourlightson\campaign\elements\SendoutElement->getPendingRecipients()
#7 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(580): putyourlightson\campaign\elements\SendoutElement->getPendingRecipientCount()
#8 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(599): putyourlightson\campaign\elements\SendoutElement->getProgressFraction()
#9 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Component.php(139): putyourlightson\campaign\elements\SendoutElement->getProgress()
#10 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/base/Element.php(1099): yii\base\Component->__get('progress')
#11 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/base/Element.php(2889): craft\base\Element->__get('progress')
#12 /Users/Bart/Development/psychologennet-portal-1.0/vendor/putyourlightson/craft-campaign/src/elements/SendoutElement.php(988): craft\base\Element->tableAttributeHtml('progress')
#13 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/base/Element.php(2456): putyourlightson\campaign\elements\SendoutElement->tableAttributeHtml('progress')
#14 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Extension/CoreExtension.php(1499): craft\base\Element->getTableAttributeHtml('progress')
#15 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/helpers/Template.php(96): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(putyourlightson\campaign\elements\SendoutElement), 'getTableAttribu...', Array, 'method', false, false)
#16 /Users/Bart/Development/psychologennet-portal-1.0/storage/runtime/compiled_templates/8c/8cab8e5846cc4120414d9f734e85486aa7530f4ef0625bd2d29c0b59084113a4.php(157): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(putyourlightson\campaign\elements\SendoutElement), 'getTableAttribu...', Array, 'method')
#17 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Template.php(407): __TwigTemplate_c36afce93491f20c2057fb20896dc63077e988fa2ffcae3d5adeee764adfdb42->doDisplay(Array, Array)
#18 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#19 /Users/Bart/Development/psychologennet-portal-1.0/storage/runtime/compiled_templates/1e/1eb296d289ae53817be4ae55f92714f0f1c061fb7710ad590327446b97ec5e32.php(100): Twig\Template->display(Array)
#20 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Template.php(407): __TwigTemplate_160775993a6578cef646cf01f11ca9caff509f44128e885e512a4eced7ba0a57->doDisplay(Array, Array)
#21 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#22 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Template.php(392): Twig\Template->display(Array)
#23 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#24 /Users/Bart/Development/psychologennet-portal-1.0/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#25 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/View.php(397): Twig\Environment->render('_elements/table...', Array)
#26 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/base/Element.php(624): craft\web\View->renderTemplate('_elements/table...', Array)
#27 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(527): craft\base\Element::indexHtml(Object(putyourlightson\campaign\elements\db\SendoutElementQuery), Array, Array, '*', 'index', true, true)
#28 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(137): craft\controllers\ElementIndexesController->elementResponseData(true, true)
#29 [internal function]: craft\controllers\ElementIndexesController->actionGetElements()
#30 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#31 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#32 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('get-elements', Array)
#33 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('get-elements', Array)
#34 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('element-indexes...', Array)
#35 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('element-indexes...', Array)
#36 /Users/Bart/Development/psychologennet-portal-1.0/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#37 /Users/Bart/Development/psychologennet-portal-1.0/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#38 /Users/Bart/Development/psychologennet-portal-1.0/web/index.php(21): yii\base\Application->run()
#39 {main}

`

@bencroker
Copy link
Collaborator

bencroker commented Apr 11, 2020

Pushed some fixes that should address this and fix the issue with the column length of SID, can you please try with the latest commit?

@bartroelands
Copy link
Author

bartroelands commented Apr 11, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants