verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
96 stars 72 forks source link

Form Element Integration Not Working - Error after updating to 1.5.0 #678

Closed joelzerner closed 2 years ago

joelzerner commented 2 years ago

Description Form element integrations are no longer working. The following error is shown in the queue manager for an integration that was previously working. I have attempted another test with a simple form (two fields) and using different entry sections but it still produces the same error.

"Failed to trigger integration: "Element integration failed for submission “103214”. Error: Cannot pass parameter 2 by reference /Users/joel/work/brighter/pac/vendor/verbb/formie/src/integrations/elements/Entry.php:261". "

Form settings

Please pick from the options below.

Additional info

engram-design commented 2 years ago

Sorry about that. Fixed for the next release. To get this fix early, change your verbb/formie requirement in composer.json to:

"require": {
  "verbb/formie": "dev-craft-3 as 1.5.0",
  "...": "..."
}

Then run composer update.

joelzerner commented 2 years ago

Mate, that is legendary and lightning fast. Thanks, as always, for your great support of a great product.

It worked initially on my simple one field form test, but then when I tried it with my more complex example (which uses a file upload field as well), it seems to cause a new error: "Failed to trigger integration: "Element integration failed for submission “104242”. Error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (pacedu_db.relations, CONSTRAINT relations_targetId_fk FOREIGN KEY (targetId) REFERENCES elements (id) ON DELETE CASCADE)\nThe SQL being executed was: INSERT INTO relations (fieldId, sourceId, sourceSiteId, targetId, sortOrder, dateCreated, dateUpdated, uid) VALUES (177, 104245, NULL, 0, 1, '2021-12-08 11:27:12', '2021-12-08 11:27:12', 'aa84ee58-6ba4-4bb4-a12e-f5f41b0a1efd') /home/pacedu/craft/vendor/yiisoft/yii2/db/Schema.php:678"."

engram-design commented 2 years ago

Hmmm, might be a different error this time, and seems related to creating the asset for the file uploaded. Here, the targetId is set to 0 which is probably the reason for the error - this should be the ID of the asset created from the file uploaded.

I'll have to investigate further. Only one other person has come across this, and I can't replicate it effectively, and I believe it only happens "sometimes"...

engram-design commented 2 years ago

In the meantime, fixed in 1.5.1

joelzerner commented 2 years ago

Would it help if I put together a test environment and gave you access? Or if you point me in the right direction (any suspicions on where it may originate) I could do some investigation too?

engram-design commented 2 years ago

@joelzerner That'd certainly help - if you're able to! It might have something to do with how you've set things up (not just Formie, if we're talking about how things are mapped to an entry).

Does this happen for new submissions, or just the ones that errored previously?

joelzerner commented 2 years ago

For both new and existing.

I've emailed you some details for a testing environment. Hopefully we can get to the bottom of it.

engram-design commented 2 years ago

Thanks @joelzerner will dive in tomorrow and see if I can get this resolved.

engram-design commented 2 years ago

Fixed in 1.5.3