tailcall icon indicating copy to clipboard operation
tailcall copied to clipboard

bug(grpc): validation errors have incorrect traces

Open tusharmath opened this issue 1 year ago • 11 comments

GRPC validation displays errors in a non-standard format. For eg:

Tailcall Config

# for test upstream server see [repo](https://github.com/tailcallhq/rust-grpc)
schema
  @server(port: 8000, graphiql: true)
  @upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10})
  @link(id: "news", src: "../src/grpc/tests/proto/news.proto", type: Protobuf) {
  query: Query
}

type Query {
  news: NewsData! @grpc(method: "news.NewsService.GetAllNews")
  newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}")
  newsByIdBatch(news: NewsInput!): News!
    @grpc(method: "news.NewsService.GetMultipleNews", body: "{{args.news}}", batchKey: ["news", "id"])
}

type News {
  id: Int
  title: String
  body: String
  # Ignoring this field for now
  # postImage: String
}

input NewsInput {
  id: Int
}

type NewsData {
  news: [News]!
}

Proto File

syntax = "proto3";

import "google/protobuf/empty.proto";

package news;

message News {
    int32 id = 1;
    string title = 2;
    string body = 3;
    string post_image = 4;
}

service NewsService {
    rpc GetAllNews (google.protobuf.Empty) returns (NewsList) {}
    rpc GetNews (NewsId) returns (News) {}
    rpc GetMultipleNews (MultipleNewsId) returns (NewsList) {}
    rpc DeleteNews (NewsId) returns (google.protobuf.Empty) {}
    rpc EditNews (News) returns (News) {}
    rpc AddNews (News) returns (News) {}
}

message NewsId {
    int32 id = 1;
}

message MultipleNewsId {
    repeated NewsId ids = 1;
}

message NewsList {
    repeated News news = 1;
}

Actual Error

 INFO File read: ./examples/grpc.graphql ... ok
 INFO File read: ./examples/../src/grpc/tests/proto/news.proto ... ok
 INFO File read: ./examples/../src/grpc/tests/proto/news.proto ... ok
 INFO N + 1 detected: 0
ERROR Invalid Configuration
Caused by:
  • missing key: postImage [at [email protected]]
  • missing key: postImage [at [email protected]]
  • missing key: postImage [at [email protected]]

Expected Error

 INFO File read: ./examples/grpc.graphql ... ok
 INFO File read: ./examples/../src/grpc/tests/proto/news.proto ... ok
 INFO File read: ./examples/../src/grpc/tests/proto/news.proto ... ok
 INFO N + 1 detected: 0
ERROR Invalid Configuration
Caused by:
  • missing key: postImage [at News]

Technical Requirements

  • Fix the error write an execution spec for it.

tusharmath avatar Mar 23 '24 06:03 tusharmath

/bounty 100$

tusharmath avatar Mar 23 '24 07:03 tusharmath

~~## 💎 $100 bounty • Tailcall Inc.~~

~~### Steps to solve:~~ ~~1. Start working: Comment /attempt #1546 with your implementation plan~~ ~~2. Submit work: Create a pull request including /claim #1546 in the PR body to claim the bounty~~ ~~3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts~~

~~🙏 Thank you for contributing to tailcallhq/tailcall!~~ ~~🧐 Checkout our guidelines before you get started.~~

Attempt Started (GMT+0) Solution
🔴 @webbdays Mar 23, 2024, 7:15:52 AM WIP
🔴 @ssddOnTop Mar 26, 2024, 3:26:25 PM #1568

algora-pbc[bot] avatar Mar 23 '24 07:03 algora-pbc[bot]

/attempt

Options

webbdays avatar Mar 23 '24 07:03 webbdays

droping.

webbdays avatar Mar 26 '24 15:03 webbdays

@ssddOnTop,

webbdays avatar Mar 26 '24 15:03 webbdays

/attempt

Algora profile Completed bounties Tech Active attempts Options
@ssddOnTop 28 tailcallhq bounties
Rust, Java,
C & more
tailcallhq/tailcall#1285
Cancel attempt

ssddOnTop avatar Mar 26 '24 15:03 ssddOnTop

This issue is not top priority for me as of now. I’ll start working in a few days so between that if anyone else raises a PR then I’ll back off.

ssddOnTop avatar Mar 26 '24 15:03 ssddOnTop

#1554

webbdays avatar Mar 26 '24 15:03 webbdays

💡 @ssddOnTop submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Apr 07 '24 17:04 algora-pbc[bot]

some work (probably valuable) have been done in https://github.com/tailcallhq/tailcall/pull/1568 those who wants to attempt, feel free to use code from the PR.

I have also commented some TODOs in the PR only those needs to be fixed imo.

ssddOnTop avatar Apr 07 '24 17:04 ssddOnTop

@tusharmath the solution should affect all the other traces or only the grpc mentioned on the issue's description?

wesleymatosdev avatar Apr 18 '24 19:04 wesleymatosdev

Action required: Issue inactive for 30 days. Status update or closure in 7 days.

github-actions[bot] avatar Jun 05 '24 21:06 github-actions[bot]

Issue closed after 7 days of inactivity.

github-actions[bot] avatar Jun 12 '24 21:06 github-actions[bot]