-
Notifications
You must be signed in to change notification settings - Fork 77
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
AWSDateTime scalar is not currently supported by RDS datetime type #386
Comments
The JavaScript which is generated also attempts to push dates up in a format different from what Omitting the field doesn't help, either, as the resolver seems to choke on the existing value in the table as well. |
I've also run into this bug, which is present in the example Marketplace schema in the amplify |
I have encountered this issue as well. Existing table data, generated through regular SQL calls, produces a DateTime value in table like this: 2019-04-17-19.00.00 -0500. When returned via AppSync resolver, the cloudwatch log shows the ResponseMapping transformedTemplate as: 2019-04-18 00:00:00.0 which then results in a null value in the response. I guess I'm more concerned that the query is returning a "rounded up" date value before it even attempts to transform it. If the format were successfully transformed, it would still be "wrong". |
Our temporary solution: AFTER
Hope they will solve this issue |
For the less experienced Amplify developers, in which file could I configure this (what seems to be a customer resolver)? |
Yeah you should copy your |
Just to have the solution clear to me and others bumping into this through online search. I would like to clarify how to implement the solution based on this example schema based, generated from MySQL table:
It appears that using RDS as datasource with most recent Amplify-CLI the resolvers are already copied to From your example it is not exactly clear to me how to implement the fix, it would be great if you could provide example to assist us on how to the default generated
|
Alright assuming your query is you will need to edit
it should work, I will double check it tomorrow |
Is there any update on this issue? I highly doubt the graphql RDS datasource part of Amplify is production-ready. It seems like we'd have to make modifications to all of the resolver templates... Not only do I have this issue with AWSDateTime scalar, but I also have issues with JSON being returned improperly from the resolver too. |
I confirm this still exists. It's a pretty ridiculous oversight in the Amplify API IMO. Error when trying to send JavaScript Date -> GraphQL AWSDateTime -> RDS: MySql / JavaScript Workaround:
JavaScript Helper:
MySql Helpers:
|
* feat: add option to open AppSync console using the CLI * fix: fixes based on PR comments
Hi - Thanks for raising this. We are looking to address this as an immediate priority via an upcoming release to GraphQL Transformer v2. I would love to get your thoughts and feedback on the RFC with the details: #815 |
Closing this as the API generated by I created an API following this guide: https://docs.amplify.aws/react/build-a-backend/graphqlapi/connect-api-to-existing-database/ Here is an example of a mutation using the same datetime value that reproduced the following error: GraphQL Schema: type Post @refersTo(name: "posts") @model @auth(rules: [{ allow: public }]) {
id: String! @primaryKey
title: String
content: String!
published: Int @default(value: "0")
blogId: String! @refersTo(name: "blog_id")
publishedDate: AWSDateTime @refersTo(name: "published_date")
} MySQL Schema create table posts
(
id varchar(40) not null
primary key,
title varchar(255) null,
content varchar(255) not null,
published tinyint(1) default 0 not null,
blog_id varchar(255) not null,
published_date datetime null
); |
Describe the bug
This is more of an issue with AppSync and RDS, I've already put in a ticket with them and the feature/bug ticket has been put in with the Amazon team. But I thought it'd be good to alert this community on this particular issue.
When pulling in an RDS datasource and a table has a column of a datetime type, the graphql-transformer applies the AppSync scalar AWSDateTime (as expected). The issue however is that the format of AWSDateTime (YYYY-MM-DDThh:mm:ss.sssZ) conflicts with the expected MySQL format of Datetime types (YYYY-MM-DD HH:MM:SS.sss).
My temporary solution is to change all AWSDateTime scalars to strings and use the MySQL datetime format.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
My hope was that RDS datetimes would support the AWSDateTime format out the box, but this is an internal conflict between services.
The text was updated successfully, but these errors were encountered: