question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No pubsub module applied for subscription

See original GitHub issue

** Which Category is your question related to? **

PubSub among with API.

** What AWS Services are you utilizing? ** API with Cognito.

** Provide additional details e.g. code snippets ** I’m doing the configuration in this way:

Amplify.configure({
  Auth: {
    identityPoolId,
    region,
    userPoolId,
    userPoolWebClientId,
  },
  API: {
    graphql_endpoint: graphqlEndpoint,
    aws_appsync_region: region,
    aws_appsync_authenticationType: 'AMAZON_COGNITO_USER_POOLS',
    graphql_headers: graphqlHeaders,
  },
});

and I’m calling

const query = (
  `${userFragment}
  ${messageFragment}
  subscription MessageCreated($conversationId: ID!) {
    messageCreated(conversationId: $conversationId) {
      ...MessageFragment
    }
  }`
);
subscribe(query, { conversationId }, callback);

But at runtime I get this error

No pubsub module applied for subscription

I can’t find in the doc where it explains how to do the configuration with API.

Can you please help me?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
elorzafecommented, Nov 24, 2018

@EgidioCaprino I have this app code working. ( I previously installed @aws-amplify/core @aws-amplify/pubsub @aws-amplify/api)

import React, { Component } from 'react';
import Amplify from '@aws-amplify/core';
import API from '@aws-amplify/api';
import _PubSub from '@aws-amplify/pubsub';
import _Auth from '@aws-amplify/auth';
import awsconfig from './aws-exports';
import { onCreateTodo } from './graphql/subscriptions'; 
Amplify.configure({
  Auth: {
    identityPoolId: awsconfig.aws_cognito_identity_pool_id,
    region: awsconfig.aws_cognito_region,
    userPoolId: awsconfig.aws_user_pools_id,
    userPoolWebClientId: awsconfig.aws_user_pools_web_client_id,
  },
  aws_appsync_graphqlEndpoint: awsconfig.aws_appsync_graphqlEndpoint,
  aws_appsync_region: awsconfig.aws_appsync_region,
  aws_appsync_authenticationType: awsconfig.aws_appsync_authenticationType,
});

class App extends Component {

  async componentDidMount(){
    API.graphql({query: onCreateTodo}).subscribe({
      next: console.log
    })
  }

  render() {
    return (
      <div className="App">
       Test
      </div>
    );
  }
}

export default App;
0reactions
github-actions[bot]commented, Jun 12, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amplify No pubsub module applied for subscription ReactJs
I am facing issue with subscriptions its throw exception
Read more >
PubSub - Subscribe & Unsubscribe - JavaScript - Amplify Docs
Learn more about how to subscribe to and unsubscribe from topics using Amplify's PubSub category - JavaScript - AWS Amplify Docs.
Read more >
Daiki Urata ⚡️ (@daiki7nohe) · Twitter
7nohe-tech-blog.vercel.… #Laravel
Read more >
Push subscriptions | Cloud Pub/Sub Documentation
The Pub/Sub service delivers messages from the same Google Cloud region on a best-effort basis. Pub/Sub no longer requires proof of ownership for...
Read more >
Subscriptions in Apollo Server - Apollo GraphQL Docs
This article uses the graphql-ws library to add support for subscriptions to Apollo Server 4. We no longer recommend using the previously documented ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found