mrkiura / chat_api_subscriptions

A GraphQL API that implements subscriptions built with Python and Ariadne
2 stars 1 forks source link

Subscription does not work fine. #3

Open mn-48 opened 1 year ago

mn-48 commented 1 year ago
subscription {
  messages(userId: "2") {
    content
    senderId
    recipientId
  }
}

# When I run the above subscription I fetch this error:

{
  "errors": [
    {
      "message": "Your GraphiQL createFetcher is not properly configured for websocket subscriptions yet. Please provide subscriptionUrl, wsClient or legacyClient option first.",
      "stack": "Error: Your GraphiQL createFetcher is not properly configured for websocket subscriptions yet. Please provide subscriptionUrl, wsClient or legacyClient option first.\n    at https://unpkg.com/graphiql@3.0.0/graphiql.min.js:2:879063\n    at https://unpkg.com/graphiql@3.0.0/graphiql.min.js:2:728459\n    at onClick (https://unpkg.com/graphiql@3.0.0/graphiql.min.js:2:780784)\n    at test.n.<computed> (https://unpkg.com/graphiql@3.0.0/graphiql.min.js:2:144508)\n    at Object.vi (https://unpkg.com/react-dom@17/umd/react-dom.production.min.js:202:330)\n    at ui (https://unpkg.com/react-dom@17/umd/react-dom.production.min.js:32:27)\n    at xi (https://unpkg.com/react-dom@17/umd/react-dom.production.min.js:32:81)\n    at zg (https://unpkg.com/react-dom@17/umd/react-dom.production.min.js:55:403)\n    at rg (https://unpkg.com/react-dom@17/umd/react-dom.production.min.js:56:317)\n    at https://unpkg.com/react-dom@17/umd/react-dom.production.min.js:66:168"
    }
  ]
}

# requirements.txt

anyio==4.0.0
ariadne==0.20.1
click==8.1.7
exceptiongroup==1.1.3
graphql-core==3.2.3
h11==0.14.0
httptools==0.6.1
idna==3.4
python-dotenv==1.0.0
PyYAML==6.0.1
sniffio==1.3.0
starlette==0.31.1
typing_extensions==4.8.0
uvicorn==0.23.2
uvloop==0.18.0
watchfiles==0.21.0
websockets==11.0.3
mn-48 commented 1 year ago

other query, mutation works fine.

mrkiura commented 1 year ago

Hey @mn-48, are you reading this tutorial? Also, what's your environment? I'll try to reproduce this on my end.

mn-48 commented 1 year ago

Yes. I have read. But I run this code within python 3.12 and virtualenv named as venv. Is venv virtualenv name the culprit???