BadRequest - invalid ref error when running FaunaDB query

This topic was automatically generated from Slack. You can find the original thread here.

Greg Harrington : I just added a FaunaDB step for the first time, and I am receiving the error below with default generated code. I am not sure where/how to start debugging this. Any thoughts appreciated!

Dan Goodman : Fauna works on a reference model similar to GCP Firestore. Somewhere in the code you have an incorrected reference to either a collection or a document.

Dan Goodman : probably in the client.query

Greg Harrington : I am still not seeing the error. This is default code generated by Pipedream. I have also compared the auto-gen code to: Create, retrieve, update, and delete documents in Fauna | Fauna Documentation

Is there any way to see/debug what line # is generating the error?

Dan Goodman : I am assuming its the last line, try commenting it out and seeing if the error persists

Dan Goodman : or do you mean the line of the fauna equivalent?

Dan Goodman : I barely have any experience is fauna so I couldn’t tell you if syntax is wrong

Greg Harrington : THANK YOU! I now have working code.

“try commenting it out…” Well, duh! Hah!! That worked.

When I click on the execution error in the left pain, it opens the Fauna action with the line #2 selected (see screenshot above)…so, I was assuming the error was there.

Your simple suggestion confirmed that the error was from line #7.

Thanks again!

Dan Goodman : No problem!

Greg Harrington : Then I tracked the error down…where were trailing spaces in params.collection_name

Greg Harrington : :confused:

Dan Goodman : Hey it happens, i’ve dealt with some of the dumbest bugs ever that took me 3+ hours to fix that were just tiny like mispellings in strings and such

Dan Goodman : nothing makes you feel dumber than a code bug

Dan Goodman : especially in non-strict languages like Python and NodeJS