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

Add wrapping error and move stacktrace to extensions #272

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

smyrick
Copy link
Member

@smyrick smyrick commented Aug 29, 2023

To provide at least a little more info, wrap the fetch function with a message to indicate that we had an issue calling the url, rather than is ambiguous TypeError that we get today

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 29, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c23444e:

Sandbox Source
maya-test-embed-next Configuration
maya-test-embed-next Configuration

@@ -383,7 +385,7 @@ export async function executeOperation({
? {
message: err.message,
...('stack' in err && typeof err.stack === 'string'
? { stack: err.stack }
? { extensions: { stack: err.stack } }
Copy link
Member Author

Choose a reason for hiding this comment

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

This is currently not GraphQL spec compliant, so moving to extensions fixes that

@changeset-bot
Copy link

changeset-bot bot commented Aug 29, 2023

🦋 Changeset detected

Latest commit: c23444e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@apollo/explorer Patch
@apollo/sandbox Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cheapsteak cheapsteak requested a review from mayakoneval August 29, 2023 20:31
Copy link
Member

@cheapsteak cheapsteak left a comment

Choose a reason for hiding this comment

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

nice, I think it's working?
image

would it be okay wait for @mayakoneval to get back next week to take another look 🙏 (been a while since I've been in this codebase)

@smyrick smyrick marked this pull request as ready for review August 31, 2023 18:27
@smyrick
Copy link
Member Author

smyrick commented Aug 31, 2023

I have remove the options from the log for now

@@ -383,7 +385,7 @@ export async function executeOperation({
? {
message: err.message,
...('stack' in err && typeof err.stack === 'string'
Copy link
Contributor

Choose a reason for hiding this comment

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

If the error stack should be in extensions, is this wrong? and this?

I can't find where the extensions wrapper comes in in the multipart response spec here.

If you test this and errors work, that works for me.

Did we test with defer & subscriptions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, those are incorrect too then.

The multipart spec has more wording around the streaming and chunking bits. It just says to follow the GraphQL spec for the other types

Both types of errors will follow the GraphQL error format (but top-level errors will never have locations or path).

That spec states that the GraphQL Error type should only have 4 fields, message, path, locations, and extensions. Any other field (like stack) is discouraged and should instead live under extensions

Previous versions of this spec did not describe the extensions entry for error formatting. While non-specified entries are not violations, they are still discouraged.

Copy link
Contributor

Choose a reason for hiding this comment

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

curious if we were able to test that the error messages are getting through as expected w stack. Can we update this PR to edit the multipart & subscription types to wrap in extension?

Copy link
Member Author

Choose a reason for hiding this comment

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

Stack message still pass through as expected today, but we are technically not compliant

@mayakoneval
Copy link
Contributor

going to test manually before merge and then I will merge myself

@smyrick
Copy link
Member Author

smyrick commented Mar 29, 2024

@mayakoneval Is this something we can still merge?

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.

3 participants