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

Feat/amplify appsync simulator #147

Merged
merged 13 commits into from
Jun 10, 2023
Merged

Feat/amplify appsync simulator #147

merged 13 commits into from
Jun 10, 2023

Conversation

maoosi
Copy link
Owner

@maoosi maoosi commented Jun 10, 2023

@vercel
Copy link

vercel bot commented Jun 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
prisma-appsync ✅ Ready (Inspect) Visit Preview Jun 10, 2023 9:06am

@cipriancaba
Copy link
Contributor

Hey @maoosi, was just testing this locally, and for some reason the playground doesn't start. I just get Cannot GET / on both http://localhost:4002 and http://localhost:4002/graphql

Introspection schema and the apis work, but I've also lost all logging from the local server

@maoosi
Copy link
Owner Author

maoosi commented Jun 18, 2023

Hey @cipriancaba - do you have more details or any particular error returned apart from Cannot GET /?

I've just tried to entirely delete my playground folder and re-create it via pnpm run dev and I get access to both the AppSync GraphQL IDE and the GraphQL endpoint at /graphql.

Note that I have also updated some of the dependencies and that the new AppSync simulator doesn't support the same createServer arguments from before (will create a migration guide for the next release).

@tomschut is everything working correctly on your end - after cloning a fresh dev branch and running pnpm run dev? Or do you also face the same problem as @cipriancaba ?

@cipriancaba
Copy link
Contributor

I am using a slightly modified command to start the server locally. Still using ts-node-dev.

npx ts-node-dev --rs --transpile-only --watch './*.ts' -- ./localServerPublicSchema.ts

Here is the output from running that command:

🧩 GraphQL server at http://localhost:4002/graphql
🚀 Prisma-AppSync GraphiQL at http://localhost:4002
(node:37358) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)

And this is what I'm passing as args:

 createServer({
    schema: schemaPublic,
    lambdaHandler: lambdaHandlerPublic,
    resolvers: resolvers,
    port: 4002,
    // wsPort: 4003,
    watchers: watchersPublic,
    headers: headersPublic,
    yogaServerOptions: {
      cors: true,
      introspection: true,
    },
  })

The response for both

Screenshot 2023-06-18 at 16 52 45

@maoosi
Copy link
Owner Author

maoosi commented Jun 18, 2023

@cipriancaba Have you tried running the playground from a fresh install and using the auto-generated boilerplate - just as a test to check whether the issue is specific to your setup, or more global?

Few things you can try:

  • The new createServer method doesn't have headers and yogaServerOptions args as it is not using GraphQL Yoga anymore, so you should remove those for now.
  • There is a new resolvers arg that requires the content from your resolvers.yaml file. Make sure it is implemented:
    const resolvers = load(readFileSync(join(process.cwd(), argv.flags.resolvers), { encoding: 'utf-8' }))
  • AppSync simulator separates the GraphQL IDE (accessible from http://localhost:4002) and the GraphQL Endpoint (accessible via http://localhost:4002/graphql). If you try to access http://localhost:4002/graphql via your browser it will not work.
  • If the above still doesn't work, I would recommend migrating to vite-node instead of ts-node-dev

@maoosi maoosi deleted the feat/amplify-appsync-simulator branch August 7, 2023 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants