question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Event trigger making the insert query fail

See original GitHub issue

I have a task table. When I call the insert_task mutation, it works. But as soon as I add an event trigger listening on inserts in that table, I get the following error:

{ "errors": [ { "internal": { "statement": "WITH \"public_task__rel_insert_result\" AS (INSERT INTO \"public\".\"task\" ( \"createdAt\", \"detectField\", \"displayField\", \"endedAt\", \"processedEntries\", \"userId\", \"id\", \"title\" ) VALUES ( DEFAULT, $1, $2, DEFAULT, DEFAULT, $3, $4, $5 ) RETURNING * ) SELECT coalesce((json_agg(\"root\" )->0), 'null' ) AS \"root\" FROM (SELECT row_to_json((SELECT \"e\" FROM (SELECT \"root.base\".\"id\" AS \"id\" ) AS \"e\" ) ) AS \"root\" FROM (SELECT * FROM \"public_task__rel_insert_result\" WHERE ('true') ) AS \"root.base\" ) AS \"root\" ", "prepared": true, "error": { "exec_status": "FatalError", "hint": null, "message": "record \"new\" has no field \"createdat\"", "status_code": "42703", "description": null }, "arguments": [ "(Oid 25,Just (\"Full Name\",Binary))", "(Oid 25,Just (\"Type\",Binary))", "(Oid 0,Just (\"82b10a97-ce9b-4530-844d-fb8065076e58\",Text))", "(Oid 0,Just (\"88c49254-49c1-48eb-8b67-3ca7c04c348b\",Text))", "(Oid 25,Just (\"file.csv\",Binary))" ] }, "path": "$.selectionSet.insert_task.args.objects[0]", "error": "postgres query error", "code": "postgres-error" } ] }

Here is the configuration of my trigger. screen shot 2018-10-12 at 11 54 30

Am I doing anything wrong here?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bruxorcommented, Oct 12, 2018

It works now. Thank you for the amazing responsiveness and for the good work! 😃

0reactions
shahidhkcommented, Oct 12, 2018

@brundozer The fix was released in v1.0.0-alpah24. Hope you have upgraded already.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trigger causes insert to fail - sql server - Stack Overflow
The trigger has several problems: it would send only one message, even if you inserted 100 messages at once (could be okay, if...
Read more >
MySQL Bugs: #72162: Insert fail caused by trigger
I have not included the SQL to populate the tables. CREATE TABLE `WhatHappened?` ( `Event` varchar(50) NOT NULL COMMENT 'Each event type must...
Read more >
Insert Into Table that have a trigger error
Dears, When creating a flow to insert data in on prem sql table that have a trigger this error appear: Microsoft SQL: The...
Read more >
Insert failed: maximum trigger depth exceeded Opportunity ...
You can probably at least partially fix this by changing the before insert trigger to after insert instead, query existing line items, ...
Read more >
13 Using Database Triggers
A trigger fired by an INSERT statement has meaningful access to new column values only. Because the row is being created by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found