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

gatsby-source-medium return the wrong number of posts #22491

Closed
Crayon-ShinChan opened this issue Mar 23, 2020 · 1 comment
Closed

gatsby-source-medium return the wrong number of posts #22491

Crayon-ShinChan opened this issue Mar 23, 2020 · 1 comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby type: upstream Issues outside of Gatsby's control, caused by dependencies

Comments

@Crayon-ShinChan
Copy link

Crayon-ShinChan commented Mar 23, 2020

Description

On Mar. 23, 2020, I tested a medium account with 4 articles.gatsby-source-medium didn't return the number of articles it should have return. It just returned totalCount: 3, which should be 4. Additionally, I tested an account with more than 4 articles, it just returned 4 articles.

Then I tried to use https://medium.com/${nameOfBlogHere}/?format=json&limit=10. There were just 3 posts not 4.

EmaSuriano also seemed to mention this at #17335 (comment)

Steps to reproduce

  1. Use the mate starter of Gatsby and set it up with a Contentful space. https://github.com/EmaSuriano/gatsby-starter-mate
  2. Change the Medium User field to the tested account in the Medium, I used @z1219202167 and @Max_Uf to test.
    image
  3. npm run develop to generate the website, use graphQL to see how many articles or posts in allMediumPost and compare these data with the actually condition (The number of posts in Medium).
query MediumPostQuery {
  site {
    siteMetadata {
      isMediumUserDefined
    }
  }
  allMediumPost(sort: { fields: createdAt, order: DESC }) {
    totalCount
    edges {
      node {
        id
        uniqueSlug
        title
        createdAt(formatString: "MMM YYYY")
        virtuals {
          subtitle
          readingTime
          previewImage {
            imageId
          }
        }
      }
    }
  }
  author: mediumUser {
    username
    name
  }
}

Expected result

Data generated by graphQL should list all the post for the account @z1219202167 because the account has less than 10 article. As for @Max_Uf, it should be 10 posts.

Actual result

However, for the account @z1219202167, I got 3 posts. For @Max_Uf, I got 4 posts.

Environment

System:
OS: macOS 10.15.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.7.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.6 - /usr/local/bin/npm
Languages:
Python: 3.7.5 - /Users/leonz/anaconda3/bin/python
Browsers:
Chrome: 80.0.3987.149
Firefox: 74.0
Safari: 13.0.5
npmPackages:
gatsby: 2.15.22 => 2.15.22
gatsby-plugin-google-analytics: ^2.1.34 => 2.1.38
gatsby-plugin-manifest: ^2.2.39 => 2.2.48
gatsby-plugin-offline: ^2.0.25 => 2.2.10
gatsby-plugin-preload-link-crossorigin: ^1.0.2 => 1.0.2
gatsby-plugin-react-helmet: ^3.1.21 => 3.1.24
gatsby-plugin-styled-components: ^3.1.18 => 3.1.21
gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
gatsby-source-contentful: 2.1.98 => 2.1.98
gatsby-source-medium: ^2.1.20 => 2.1.22
gatsby-transformer-remark: ^2.6.53 => 2.6.59
npmGlobalPackages:
gatsby-cli: 2.7.53

@Crayon-ShinChan Crayon-ShinChan added the type: bug An issue or pull request relating to a bug in Gatsby label Mar 23, 2020
@ascorbic
Copy link
Contributor

Hi,
This appears to be an issue with the Medium feed. As you pointed out, the feed is only returning 3 posts for the first user, which is why we can only display those. In the issue you linked, it states that this is just what the Medium JSON feed does. Unfortunately the only other option is to use the RSS plugin instead. Somebody could add support for the Medium API to this plugin, but it doesn't seem to be a self-service API which means it's not an option for most people. I think some of the workarounds in #17335 are your best bet.

@ascorbic ascorbic added the type: upstream Issues outside of Gatsby's control, caused by dependencies label Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby type: upstream Issues outside of Gatsby's control, caused by dependencies
Projects
None yet
Development

No branches or pull requests

2 participants