Open SaileshKumar opened 3 years ago
Hey @SaileshKumar, please see this section of the docs for information on how to configure a Custom Lambda Resolver. You need to pass through the event
object in your Lambda return statement.
Hey @SaileshKumar just wanted to follow up on this one to see if you're still experiencing this?
Hey @josefaidt , we are. Not sure I understand the suggestion from @iartemiev .
Our setup is as follows:
Schema:
type Class @model {
live_status: String @function(name: "computeClassLiveStatus-${env}")
}
where computeClassLiveStatus is a lambda that looks something (simplified) like:
exports.handler = async (event, context) => {
if ({SOMETHING}) { return "LIVE"}
else { return "PAST" }
}
when I call getClass or listClasses and query for live_status, I'll correctly see either PAST or LIVE as a value.
However
query MyQuery {
listClasses(filter: {liveStatus: {eq: "TEST"}}) {
items {
liveStatus
}
}
}
will return an empty array.
Is the suggestion to add a different return to the JS lambda computeClassLiveStatus?
Hey @SaileshKumar apologies for the delay here. I'm able to reproduce this, marking as a bug
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
GraphQL API
Amplify Categories
function, api
Environment information
Describe the bug
I'm unable to filter on a scalar field that is backed by a resolver. if there is no resolver, it performs as expected. Example:
Here, liveStatus is backed by a resolver that is a lambda:
But then:
Expected behavior
Filtering on liveStatus should filter the items with their liveStatus, not return an empty list.
Reproduction steps
Code Snippet
// Put your code below this line. schema.graphql:
Then Lambda Function:
And query:
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response