Skip to content
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

Actions stopped working #9170

Open
Stano9 opened this issue Nov 2, 2022 · 19 comments
Open

Actions stopped working #9170

Stano9 opened this issue Nov 2, 2022 · 19 comments
Labels
k/bug Something isn't working

Comments

@Stano9
Copy link

Stano9 commented Nov 2, 2022

Version Information

2.14.0

All of my Hasura actions stopped working after i updated to latest version v2.14.0, i constantly keep getting the same error

The Error:
{ "errors": [ { "extensions": { "code": "unexpected", "path": "$" }, "message": "Response Transformation Failed" } ] }

The Action types
type Query { auth( username: String! password: String! ): AuthResponse }
type AuthResponse { session_token: String }
My Rest Endpoint Code
export const auth = async (request: Request, response: Response, next) => { response.status(200).json({ session_token: 'sometoken' }) }

@Stano9 Stano9 added the k/bug Something isn't working label Nov 2, 2022
@tirumaraiselvan
Copy link
Contributor

Thanks for reporting. Any chance you can share the metadata for one of your actions (which is throwing this) from v2.14? You will need to export it out from the console (via the Settings button on top-right) or export_metadata API on the 2.14 instance (and not your version control).

@Stano9
Copy link
Author

Stano9 commented Nov 2, 2022

Sure, here you go
{ "name": "auth", "definition": { "handler": "https://cantsharetheurlhere.com", "output_type": "AuthResponse", "forward_client_headers": true, "arguments": [ { "name": "username", "type": "String!" }, { "name": "password", "type": "String!" } ], "request_transform": { "method": "GET", "query_params": { "username": "{{$body.input.username}}", "password":"{{$body.input.password}}" }, "request_headers": { "add_headers": {}, "remove_headers": [ "content-type" ] }, "template_engine": "Kriti", "version": 2 }, "response_transform": { "body": { "action": "transform", "template": "" }, "template_engine": "Kriti", "version": 2 }, "type": "query" }, "comment": "Auth", "permissions": [ { "role": "user" } ] }

@BenoitRanque
Copy link
Contributor

@Stano9 your metadata includes an empty response transform which is likely to be the problem.
Did you purposefully add these response transforms? Do you have a source-controlled version of metadata we can compare against?

@Stano9
Copy link
Author

Stano9 commented Nov 2, 2022

I have not added transforms on the actions no,
image,
i created a new blank action just in case but still same error

@Stano9
Copy link
Author

Stano9 commented Nov 2, 2022

@Stano9 your metadata includes an empty response transform which is likely to be the problem. Did you purposefully add these response transforms? Do you have a source-controlled version of metadata we can compare against?

Also, no i don't have source-controlled metadata

@BenoitRanque
Copy link
Contributor

I see. Strange how things got in that state. For the time being, you can most likely fix your issue by removing the following string wherever it appears in your metadata:

"response_transform": { "body": { "action": "transform", "template": "" }, "template_engine": "Kriti", "version": 2 },

Then you can apply that file again and should be good to go.

@Stano9
Copy link
Author

Stano9 commented Nov 2, 2022

@BenoitRanque,
Luckily i have a backup from the old Metadata schema before the update and here is the diff in the action
https://www.diffchecker.com/BV5DZcC5, change was done by the update, It was not changed manually by me.
Also it appends it on freshly created actions as well, it's not only on the old ones,
The update i did was from 2.10 to 2.14.0

@BenoitRanque
Copy link
Contributor

@Stano9 I'm unable to reproduce with the following steps:

  • create an action in 2.10
  • upgrade to 2.14

Was there anything else you did during/before/after the upgrade?

@Stano9
Copy link
Author

Stano9 commented Nov 2, 2022

I haven't done anything during/before/after the upgrade @BenoitRanque

I created a fresh new action with without doing a Request Transform or Response Transform, and it did not append the empty transform Object in metadata.

However when i added a Request Transform it automatically appended the empty Response Transform,
So my guess is that it adds a bad Response Transform object when i add a Request Transform

@BenoitRanque
Copy link
Contributor

@Stano9 thanks, I can reproduce similar problems now.

  • adding a request transform also adds a response transform
  • exporting this metadata via the cli will not show the response transform
  • deleting a request transform does not delete the request transform

@mrpotato3
Copy link

Same error here.

I created actions in v2.7.0 and, after upgrade to v2.14.0, nothing works.

@BenoitRanque
Copy link
Contributor

Still unable to repro this with only an upgrade. @mrpotato3 @Stano9 if you're able to provide more details on what upgrading meant for you we would be grateful.

@arushsharma24
Copy link

Still unable to repro this with only an upgrade. @mrpotato3 @Stano9 if you're able to provide more details on what upgrading meant for you we would be grateful.

@BenoitRanque
This issue I created has more details that might be useful in helping you to reproduce this issue: #9174

@tirumaraiselvan
Copy link
Contributor

We have fixed an issue when the console is used in modifying the action but we are still trying to figure out this error when the console is not involved i.e. server upgrade -> actions failure.

@tirumaraiselvan
Copy link
Contributor

tirumaraiselvan commented Nov 3, 2022

@Stano9 @mrpotato3 Just want to confirm once again: You upgraded the server by changing the image and started receiving this error without any console or CLI involvement right?

Also, are you using the CLI-migrations image or the regular image?

@Stano9
Copy link
Author

Stano9 commented Nov 3, 2022

Hey @tirumaraiselvan sorry for late reply, we are using Elastic Container Service on AWS(with Fargate) , we've just changed the image there and that's all, no migrations were done.

@mrpotato3
Copy link

Hi @tirumaraiselvan I upgraded docker image version from v2.7.0 to v2.14.0. I'm using Kubernetes.

Thanks!

@tirumaraiselvan
Copy link
Contributor

@mrpotato3 Can you share your metadata from v2.7.0 pls?

@BenoitRanque
Copy link
Contributor

@Stano9 the bug we've identified and fixed addresses cases where an action was modified and saved from the console, which would result in an empty response transform as you witnessed.

We're still unable to reproduce an issue where metadata would be updated after an upgrade to corrupt all actions.

Can you explain more on your upgrade process? Where any of the actions modified after the update?
Are you using the hasura cli? If so, what version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants