Has anyone used AWS Appsync with Windmill?
I’m just trying to setup a basic graphql script in Windmill and can’t seem to establish a connection with my API.
This is my first time testing the native graphql option. I provide my URL and the header “x-api-key” but the test connection times out.
Any guidance would be appreciated. Maybe I am missing something obvious ☺️
4 Replies
Hi, we managed to connect to our AWS AppSync GraphQL api in the same way as you described.
You might get a better error if you run a native GraphQL script instead of just testing the connection, thus avoiding the timeout.
Could you try connecting using a GraphQL client (not amplify) in TypeScript?
I tried running it but it just spins trying to do something with no error/log.
I will write it in Typescipt (which I have done before when GraphQL wasn’t a supported language) and see if I have any issues or better error messages there.
I currently use Cognito for Auth and therefore I use a custom header “Authorization” instead of the “bearer_token”.
I have some resolvers that only require an API key but I can’t seem to establish a connection with either.
Not sure if I am going something wrong there?
I have tested this and it worked as expected.
import { gql, GraphQLClient } from "npm:graphql-request@6.0.0";
export async function main(
accessToken: string,
query: string,
variables: any,
) {
const endpoint =
"https://MYAPI.amazonaws.com/graphql";
const client = new GraphQLClient(endpoint);
client.setHeader("Authorization", accessToken);
const q = gql
${query}
;
const res = await client.request(q, variables);
return res;
}
But when I try to use a GraphQL Resource with native GraphQL using this for the resource.
{
"base_url": "https://MYAPI.amazonaws.com/graphql",
"bearer_token": "",
"custom_headers": {
"Authorization": "MYACCESSTOKEN"
}
}
I can’t seems to connect to the API. If I test the connection it times out if I run the script with a basic query it just hangs loading and all I see is tag: graphql in the “Log & Result” section.
I have a warning that says “no worker with the tag graphql is running”You need to go to the worker settings and assign the graphql tag to one of your worker groups. Here's more details: https://www.windmill.dev/docs/core_concepts/worker_groups#how-to-assign-worker-tags-to-a-worker-group
Workers and Worker Groups | Windmill
Workers are autonomous processes that run one script at a time using the entire cpu and memory available
Yeah I found this thread. Seems to have resolved my issue! Thanks https://discord.com/channels/930051556043276338/1197942760301404191/1197948867874922677