aheissenberger / serverless-appsync-offline

Serverless AWS AppSync Offline Plugin - Allow to run AppSync locally for serverless framework
MIT License
90 stars 25 forks source link

Starts with No Errors/Warnings but have no access to endpoint #14

Closed alexcallow closed 5 years ago

alexcallow commented 5 years ago

Hey guys,

Im running serverless-appsync-plugin, serverless-appsync-offline and serverless-offline. When I run

serverless --stage local offline start --port 5000

Serverless runs and gives me a AppSync started: http://localhost:5000/graphql

But when i try to use it i get this error

{
  "statusCode": 404,
  "error": "Serverless-offline: route not found.",
  "currentRoute": "post - /graphql",
  "existingRoutes": []
}

any ideas.

Thanks

mikebrits commented 5 years ago

I'm also finding this issue. It looks like it is silently failing possibly, because I've taken a look at the logs after running yarn install or upgrade and I get a list of node-gyp errors, specifically for snappy and zmq.

It looks like snappy is failing on this command: gyp ERR! command \"/usr/local/bin/node\" \"/Users/MikeBrits/Dev/my-project/node_modules/snappy/node_modules/.bin/node-gyp\" \"rebuild\"

For zmq: Error running install script for optional dependency: "/Users/MikeBrits/Dev/my-project/node_modules/zmq: Command failed.

I've had to just work online, publishing my changes every time and it's become quite tiresome. Let me know if the same applies to you?

aheissenberger commented 5 years ago

@alexcallow can you provide me with a very simple serverless.yml to reproduce your problem

Adrxx commented 5 years ago

This happens to me too.

Adrxx commented 5 years ago

Ok, after much experimenting, seems like MY problem was that I wasn't sending the x-api-key header on my graphiql client, the value of the header doesn't really matter. You need this header even if you don't define authenticationType in the appSync config. Hope this helps!

paige1381 commented 5 years ago

@Adrxx I think I'm experiencing the same problem, would you mind posting a code snippet of how you're passing the x-api-key through? Is this in your serverless file in the appsync-offline config or through your actual request, or somewhere else? Sorry, very new to appsync and using serverless, thank you in advance!

fgiarritiello commented 5 years ago

Getting this error as well. I'm passing the x-api-key in the header but no vail. Any help pls?

aheissenberger commented 5 years ago

@fgiarritiello try this:

curl -X POST \
  http://localhost:62222/graphql \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: APIKEY' \
  -d '{
    "query": "{ hello { world } }"
}'

_Note: If you're using API_KEY as your authenticationType, then a x-api-key header has to be present in the request. The value of the key doesn't really matter._