-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature/Issue: AWSDate Type Serialization Issue with Override Decorator #165
Comments
The date format issue you're facing is due to Prisma Client. It always returns dates as DateTime, regardless of the database format used. Here are some open issues about it: prisma/prisma#7490 Prisma-AppSync only acts as a bridge that connects Prisma to AWS AppSync and doesn't alter the data. Supporting AWSDate like AWSDateTime can only happen after the Prisma team fixes this issue. For your use case, I would suggest removing |
Hi @maoosi , Thanks for the response on this! I am aware of the Prisma issue which I dont think they will ever fix so thought it could be handled in this package potentially. Although, I agree it is not an issue with this package! We have a solution for this using the prisma middleware or extensions, is there anyway of overriding the prisma client in |
@d-e-a-n-f yes, absolutely! You can access the underlying Prisma Client instance like this: // init prisma-appsync
const prismaAppSync = new PrismaAppSync()
// middleware
prismaAppSync.prismaClient.$use(async (params, next) => {
return next(params)
})
// lambda resolver
export const main = async (event: AppSyncResolverEvent<any>) => {
return await prismaAppSync.resolve({ event })
} |
Description:
When using the
AWSDate
type inside the override decorator/// @gql(scalars: { asOfDate: "AWSDate" })
, the package struggles with correctly serializing from an ISO8601 DateTime to a Date.Expected Behavior:
AWSDate
type is employed, I anticipate an automatic conversion that adapts the Date object (as given by Prisma) into an appropriate format compatible withAWSDate
.Schema Model Field:
Relevant Screenshot:
![AWSDate Serialization Issue](https://private-user-images.githubusercontent.com/79139849/266603780-ca165590-445e-4370-8a60-7d23fc50f00e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxNTY5MjQsIm5iZiI6MTcyNjE1NjYyNCwicGF0aCI6Ii83OTEzOTg0OS8yNjY2MDM3ODAtY2ExNjU1OTAtNDQ1ZS00MzcwLThhNjAtN2QyM2ZjNTBmMDBlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDE1NTcwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFkYmNhMGNkNjA4NDUyMWM1MTFhOTVjZDdjMmJlNDg4OGQ1MTgwMDg1NzlhOWNkZmNkMDM1ZTI3YTI4MDUzNTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2GQ3uvZy4zhmtDkYSnnAVhSjm8-ZYEOtWwd_2BCAmOg)
The text was updated successfully, but these errors were encountered: