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

Cross api query meet error #491

Closed
javacode123 opened this issue Dec 26, 2022 · 6 comments · Fixed by #496
Closed

Cross api query meet error #491

javacode123 opened this issue Dec 26, 2022 · 6 comments · Fixed by #496
Assignees
Labels
bug Something isn't working

Comments

@javacode123
Copy link
Contributor

javacode123 commented Dec 26, 2022

Bug description

1: api config:

const countries = introspect.graphql({
	apiNamespace: 'countries',
	url: 'https://countries.trevorblades.com/',
});

const todo = introspect.mysql({
	apiNamespace: 'todo',
	databaseURL: 'mysql://root:zjl@localhost:3306/fireboom-issue',
});

// configureWunderGraph emits the configuration
configureWunderGraphApplication({
	apis: [
		countries,
		todo,
		/*federatedApi,
        openAPI,
        graphQLAPI*/
	],
	server,
	operations,
	codeGenerators: [
		{
			templates: [
				// use all the typescript react templates to generate a client
				...templates.typescript.all,
			],
			// create-react-app expects all code to be inside /src
			// path: "../frontend/src/generated",
		},
	],
	cors: {
		...cors.allowAll,
		allowedOrigins:
			process.env.NODE_ENV === 'production'
				? [
						// change this before deploying to production to the actual domain where you're deploying your app
						'http://localhost:3000',
				  ]
				: ['http://localhost:3000', new EnvironmentVariable('WG_ALLOWED_ORIGIN')],
	},
	dotGraphQLConfig: {
		hasDotWunderGraphDirectory: false,
	},
	security: {
		enableGraphQLEndpoint: process.env.NODE_ENV !== 'production' || process.env.GITPOD_WORKSPACE_ID !== undefined,
	},
});

2: db table:

CREATE TABLE `test` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

3: operation:

query MyQuery($code: ID! @internal) {
  todo_findFirsttest {
    id
    name @export(as:"code")
    _join {
      countries_country(code: $code) {
        code
        capital
      }
    }
  }
}

4: http quey
Uploading image.png…

How to reproduce

Expected behavior

No response

WunderGraph information

Environment & setup

  • OS:
  • Go version:
  • Database:
  • Node.js version:

WunderCtl Version

@javacode123 javacode123 added the bug Something isn't working label Dec 26, 2022
@javacode123
Copy link
Contributor Author

javacode123 commented Dec 26, 2022

http response:

{
    "errors": [
        {
            "message": "GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR"
            }
        }
    ],
    "data": {
        "todo_findFirsttest": {
            "id": 4,
            "name": "AE",
            "_join": {
                "countries_country": null
            }
        }
    }
}

@javacode123
Copy link
Contributor Author

table recoders:
image

@devsergiy
Copy link
Contributor

@javacode123 this fix will be included in the next sdk release

thanks a lot for you report!

@devsergiy devsergiy removed the in-progress Currently being implemented label Jan 5, 2023
@javacode123
Copy link
Contributor Author

@spetrunin sorry, it seems not fix, i use wundergraph code with commit 556fae1a, it sill return err

{
    "errors": [
        {
            "message": "GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR"
            }
        }
    ],
    "data": {
        "todo_findFirsttest": {
            "id": 4,
            "name": "AD",
            "_join": {
                "countries_country": null
            }
        }
    }
}

@javacode123
Copy link
Contributor Author

or i need update node wundergraph/sdk to which version

@devsergiy
Copy link
Contributor

@wundergraph/sdk@0.131.0 was released with this fix

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

Successfully merging a pull request may close this issue.

2 participants