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

Clarify grpc errors for missing source collection #802

Merged

Conversation

samirketema
Copy link
Contributor

@samirketema samirketema commented Aug 8, 2023

Description of change

Adds more clarity to gRPC errors from turbine-core when an app has no sources defined.

Fixes https://github.com/meroxa/product/issues/936

Type of change

  • New feature
  • Bug fix
  • Refactor
  • Documentation

How was this tested?

  • Manual Tests
  • Unit Tests
  • Tested in staging
  • Tested in minikube

Demo

Before

❯ ../cli/meroxa apps deploy     
Validating your app.json...
        ✔ Checked your language is "golang"
        ✔ Checked your application name is "notion-s3"
Checking for uncommitted changes...
        ✔ No uncommitted changes!
Error: 2023/08/07 14:13:23 rpc error: code = Unknown desc = invalid ProcessCollectionRequest.Collection: embedded message failed validation | caused by: invalid Collection.Name: value length must be at least 1 runes
exit status 1

After

❯ ../cli/meroxa apps deploy
Validating your app.json...
        ✔ Checked your language is "golang"
        ✔ Checked your application name is "notion-s3"
Checking for uncommitted changes...
        ✔ No uncommitted changes!
Error: missing source collection, please ensure that you have configured your source correctly:
https://docs.meroxa.com/turbine/troubleshooting"

Documentation updated

Will need to make an adjustment to the docs before merging this PR, to link directly to the new high-level troubleshooting checklist: https://github.com/meroxa/meroxa-docs/pull/431

@@ -214,6 +221,11 @@ func RunCmdWithErrorDetection(_ context.Context, cmd *exec.Cmd, _ log.Logger) (s
if stdOutMsg != "" {
errLog = stdOutMsg + errLog
}

if strings.Contains(errLog, "rpc error") {
errLog = clarifyGrpcErrors(errLog)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any chance stdout would be helpful here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the entirety of stdout for this error is the grpc error. So we could:

  • include the grpc error along with this clarified, actionable error (in case that stdout is useful for a different, concurrent issue)
  • trim the grpc error from stdout, and add it to the actionable error
  • replace stdout entirely with this clarified error (current approach)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I landed on a middle-ground solution that gives us some flexibility. I added a log.Debug() above when we are doing this replacing. that way, if we are debugging, we still have visibility into the full stdout, without adding more error-specific logic.

with --debug:

~/go/src/notion-s3 main
❯ ../cli/meroxa apps deploy --debug
Validating your app.json...
        ✔ Checked your language is "golang"
        ✔ Checked your application name is "notion-s3"
Checking for uncommitted changes...
        ✔ No uncommitted changes!
<redacted prior steps for conciseness>
2023/08/08 15:19:27 rpc error: code = Unknown desc = invalid ProcessCollectionRequest.Collection: embedded message failed validation | caused by: invalid Collection.Name: value length must be at least 1 runes
exit status 1
Error: missing source or source collection, please ensure that you have configured your source correctly:
https://docs.meroxa.com/turbine/troubleshooting#troubleshooting-checklist"

without --debug:

~/go/src/notion-s3 main
❯ ../cli/meroxa apps deploy        
Validating your app.json...
        ✔ Checked your language is "golang"
        ✔ Checked your application name is "notion-s3"
Checking for uncommitted changes...
        ✔ No uncommitted changes!
Error: missing source or source collection, please ensure that you have configured your source correctly:
https://docs.meroxa.com/turbine/troubleshooting#troubleshooting-checklist"

Copy link
Contributor

@jayjayjpg jayjayjpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the super quick iteration on this! I just left one more clarifying question on the error output since I'm not super familiar with the implementation myself -- if this is intended, feel free to ask me for another review and I can ✅

cmd/meroxa/turbine/utils.go Show resolved Hide resolved
@samirketema samirketema merged commit 4a4a81d into master Aug 8, 2023
4 of 5 checks passed
@samirketema samirketema deleted the samir/clarify-grpc-errors-missing-source-collection branch August 8, 2023 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants