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

router panics when parsing invalid schema #2269

Closed
garypen opened this issue Dec 14, 2022 · 7 comments · Fixed by #2448
Closed

router panics when parsing invalid schema #2269

garypen opened this issue Dec 14, 2022 · 7 comments · Fixed by #2448
Assignees
Labels

Comments

@garypen
Copy link
Contributor

garypen commented Dec 14, 2022

2022-12-14T14:30:04.095417Z  INFO reloading schema
2022-12-14T14:30:04.120186Z ERROR could not parse schema: Api("Syntax Error: Unexpected <EOF>.")
2022-12-14T14:30:04.463826Z apollo-router/src/files.rs:34  WARN apollo_router::files: could not process file watch notification. send failed because channel is full
2022-12-14T14:30:04.464656Z  INFO reloading schema
apollo-parser parsing error.

  × expected R_PAREN, got __Schema
2022-12-14T14:30:04.472293Z ERROR panicked at 'failed printing to stdout: formatter error', library/std/src/io/stdio.rs:1015:9

From a customer comment on #2098. I'm not sure which version of the router caused this problem.

@jon-frankel
Copy link

@garypen I see I was using version 1.5.0 — I think 1.6.0 just became available. I updated just now and I saw the error message on the first attempt at running it. Trying three more times, it does start and stay up, though the warnings continue to happen. I also see the warning when running from inside docker.

@Geal
Copy link
Contributor

Geal commented Jan 20, 2023

@SimonSapin does this still happen with recent apollo-parser fixes?

@SimonSapin
Copy link
Contributor

No, nothing changed around this recently that I know of. I can reproduce the error on dev.

Schema parsing calls apollo_router::error::ParseErrors::print to format errors with miette to stdout. I don’t know what it does that instead of normal logging. Then it’s impl Debug for miette::Report that returns an error, but it’s not obvious from reading miette code why it does that either.

@SimonSapin
Copy link
Contributor

It looks like miette errors because apollo-parser reports an index for some errors that is out of bounds of the input string.

@SimonSapin
Copy link
Contributor

Found the root cause: the input string we give to apollo-parser has introspection_types.graphql concatenated to it, but not the one we give to miette

@Geal
Copy link
Contributor

Geal commented Jan 20, 2023

oh, nice one!

SimonSapin added a commit that referenced this issue Jan 23, 2023
Fixes #2269

**Checklist**

Complete the checklist (and note appropriate exceptions) before a final
PR is raised.

- [x] Changes are compatible[^1]
- [x] Documentation[^2] completed
- [x] Performance impact assessed and acceptable
- Tests added and passing[^3]
    - [x] Unit Tests
    - [ ] Integration Tests
    - [ ] Manual Tests

**Exceptions**

*Note any exceptions here*

**Notes**

[^1]. It may be appropriate to bring upcoming changes to the attention
of other (impacted) groups. Please endeavour to do this before seeking
PR approval. The mechanism for doing this will vary considerably, so use
your judgement as to how and when to do this.
[^2]. Configuration is an important part of many changes. Where
applicable please try to document configuration examples.
[^3]. Tick whichever testing boxes are applicable. If you are adding
Manual Tests:
- please document the manual testing (extensively) in the Exceptions.
- please raise a separate issue to automate the test and label it (or
ask for it to be labeled) as `manual test`
@smyrick
Copy link
Member

smyrick commented Feb 28, 2023

This is not a Router issue but commenting here that it would be nice if Studio/checks could validate not just schema types but config and schema metadata too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants