conradj / gatsby-source-pocket

Fetch data from Pocket API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined tags throw an error

laugri opened this issue · comments

Hi guys !

First, thanks for having created the plugin! I'm using it to display my favorite articles on my personal website (which is not published yet).
I have run into the following error:

image

Indeed, this article has no tags. See the object returned by the Pocket API:

"1952903649": {
      "item_id": "1952903649",
      "resolved_id": "1952903649",
      "given_url": "https:\/\/hbr.org\/2017\/11\/many-strategies-fail-because-theyre-not-actually-strategies",
      "given_title": "Many Strategies Fail Because They’re Not Actually Strategies",
      "favorite": "1",
      "status": "1",
      "time_added": "1517864651",
      "time_updated": "1553810681",
      "time_read": "1518768063",
      "time_favorited": "1553640743",
      "sort_id": 47,
      "resolved_title": "Many Strategies Fail Because They’re Not Actually Strategies",
      "resolved_url": "https:\/\/hbr.org\/2017\/11\/many-strategies-fail-because-theyre-not-actually-strategies",
      "excerpt": "Many strategy execution processes fail because the firm does not have something worth executing. The strategy consultants come in, do their work, and document the new strategy in a PowerPoint presentation and a weighty report.",
      "is_article": "1",
      "is_index": "0",
      "has_video": "0",
      "has_image": "1",
      "word_count": "1377",
      "lang": "en",
      "time_to_read": 6,
      "top_image_url": "https:\/\/hbr.org\/resources\/images\/article_assets\/2017\/11\/nov17-08-135629213-Lobo-Press.jpg",
      "authors": {
        "97789314": {
          "item_id": "1952903649",
          "author_id": "97789314",
          "name": "Freek Vermeulen",
          "url": "https:\/\/hbr.org\/search?term=freek%20vermeulen"
        }
      },
      "image": {
        "item_id": "1952903649",
        "src": "https:\/\/hbr.org\/resources\/images\/article_assets\/2017\/11\/nov17-08-135629213-Lobo-Press.jpg",
        "width": "1200",
        "height": "675"
      },
      "images": {
        "1": {
          "item_id": "1952903649",
          "image_id": "1",
          "src": "https:\/\/hbr.org\/resources\/images\/article_assets\/2017\/11\/nov17-08-135629213-Lobo-Press.jpg",
          "width": "1200",
          "height": "675",
          "credit": "Lobo Press\/Getty Images",
          "caption": "Lobo Press\/Getty Images"
        }
      },
      "domain_metadata": {
        "name": "Harvard Business Review",
        "logo": "https:\/\/logo.clearbit.com\/hbr.org?size=800",
        "greyscale_logo": "https:\/\/logo.clearbit.com\/hbr.org?size=800&greyscale=true"
      },
      "listen_duration_estimate": 533
    },

It's a one-line fix at line 135 tags: Object.keys(datum.tags), but I can make a PR if you don't have time for it.

Many thanks

Hi @laugri thanks for finding this - I pretty much never use tags maybe why I've not seen this. Please make a PR if you can 🥇

@conradj Ok will do! I tried pushing a branch with a fix before opening the issue, but I think I need some more permissions to do that and open a PR.

@laugri thank you! You shouldn't need any permissions to fork the repo and submit a PR, and others have done this. Happy to step through it with you if it would help?

@conradj yep sorry, I just submitted a PR.

@conradj Sorry to spam but this bug prevents me from deploying my project so if you could review and merge soon, it would be awesome !