gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.28k stars 10.31k forks source link

Gatsby cloud build "Timed Out" #21150

Closed dietrichmax closed 4 years ago

dietrichmax commented 4 years ago

Summary

Relevant information

I wanted to change my workflow and try out Gatsby cloud. After following the instructions and triggering a build it somehow got stuck at "Generating image thumbnails": grafik

After about 1 hour and some minutes the built "Timed Out" with no errors: grafik

A local build is working successfully and takes ~ 4 minutes.

When i try to trigger a new build it get's immidiately "Canceled" with no errors. grafik

What do i have to change so the build doesn't get timed out at "Generating image thumbnails" or "Canceled" immidiately?

You can find the repositorie here: https://github.com/DaTurboD/GIS-Netzwerk

17:39:04 PM: From https://github.com/DaTurboD/GIS-Netzwerk * branch master -> FETCH_HEAD

17:39:04 PM: fd6972d..b7a5e71 master -> origin/master

17:39:04 PM: HEAD is now at b7a5e71 modified: gatsby-config.js

17:39:04 PM: Already on 'master'

17:39:04 PM: Your branch is up-to-date with 'origin/master'.

17:39:07 PM: Node version v10.18.1

17:39:07 PM: Gatsby version Gatsby CLI version: 2.8.29 Gatsby version: 2.19.12 Note: this is the Gatsby version for the site at: /usr/src/app/www BUILDS

17:39:10 PM: success open and validate gatsby-configs - 0.138s

17:39:11 PM: success load plugins - 1.352s

17:39:11 PM: success onPreInit - 0.029s

17:39:12 PM: success delete html and css files from previous builds - 0.028s

17:39:12 PM: success initialize cache - 0.093s

17:39:12 PM: success copy gatsby files - 0.073s

17:39:12 PM: warning gatsby-plugin-feed was initialized in gatsby-config.js without a title in a feed. This means that the plugin will use the default feed title, which may not match your use case. This behavior will be removed in the next major release of gatsby-plugin-feed. For more info, check out: https://gatsby.dev/adding-rss-feed

17:39:12 PM: success onPreBootstrap - 0.015s

17:39:12 PM: success createSchemaCustomization - 0.097s

17:39:15 PM: success source and transform nodes - 3.063s

17:39:16 PM: success building schema - 0.842s

17:39:16 PM: success createPages - 0.299s

17:39:17 PM: success createPagesStatefully - 0.268s

17:39:17 PM: success onPreExtractQueries - 0.001s

17:39:17 PM: success update schema - 0.069s

17:39:18 PM: success extract queries from components - 0.749s

17:39:18 PM: success write out requires - 0.008s

17:39:18 PM: success write out redirect data - 0.002s

17:39:18 PM: warning The icon(./static/logos/logo.png) you provided to 'gatsby-plugin-manifest' is not square. The icons we generate will be square and for the best results we recommend you provide a square icon.

17:39:25 PM: success Build manifest and related icons - 6.933s

17:39:25 PM: success onPostBootstrap - 7.529s ⠀ info bootstrap finished - 17.855 s ⠀

17:39:44 PM: warning The requested width "400px" for a resolutions field for the file /usr/src/app/www/content/posts/gis/geodaten-konvertierung/GeoTKF-Formate.png was larger than the actual image width of 191px! If possible, replace the current image with a larger one.

17:40:15 PM: warning The requested width "400px" for a resolutions field for the file /usr/src/app/www/content/posts/gis/geodaten-konvertierung/GeoTKF-Formate.png was larger than the actual image width of 191px! If possible, replace the current image with a larger one. warning The requested width "400px" for a resolutions field for the file /usr/src/app/www/content/posts/gis/geodaten-konvertierung/GeoTKF-Formate.png was larger than the actual image width of 191px! If possible, replace the current image with a larger one.

17:41:58 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`

17:42:07 PM: warning chunk styles [mini-css-extract-plugin] Conflicting order between: * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/PostCover/PostCover.scss * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/PostTags/PostTags.scss * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/TagNavigation/TagNavigationGeoinformatik.scss

17:42:07 PM: warning chunk styles [mini-css-extract-plugin] Conflicting order between: * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/PostTags/PostTags.scss * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/TagNavigation/TagNavigationGeoinformatik.scss warning chunk styles [mini-css-extract-plugin] Conflicting order between: * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/PostPreview/card.scss * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./src/components/TagNavigation/TagNavigationGeoinformatik.scss

17:42:07 PM: success Building production JavaScript and CSS bundles - 70.287s

17:42:08 PM: success Rewriting compilation hashes - 0.001s

17:42:08 PM: warning code block or inline code language not specified in markdown. applying generic code block

17:42:09 PM: warning unable to find prism language 'txt' for highlighting. applying generic code block

17:42:10 PM: Generated Twitter Card: public/py-qgis-layer-als-bilder-exportieren/twitter-card.jpg Generated Twitter Card: public/extraktion-von-hohl-und-vollformen-aus-einem-raster-dgm/twitter-card.jpg Generated Twitter Card: public/erste-schritte-mit-react-und-leaflet/twitter-card.jpg

17:42:10 PM: Generated Twitter Card: public/seitenaufrufe-mit-gatsby-und-google-analytics-reporting-api-anzeigen/twitter-card.jpg

17:42:11 PM: Generated Twitter Card: public/was-ist-gis/twitter-card.jpg

17:42:11 PM: Generated Twitter Card: public/javascript-web-map-mit-open-layers-erstellen/twitter-card.jpg

17:42:12 PM: Generated Twitter Card: public/migration-von-word-press-nach-gatsby/twitter-card.jpg

17:42:12 PM: Generated Twitter Card: public/geoportal-deutschland-und-geoportale-der-deutschen-bundeslander/twitter-card.jpg

17:42:13 PM: Generated Twitter Card: public/geodaten-transformation-konvertierung-und-formatumwandlung/twitter-card.jpg

17:42:13 PM: Generated Twitter Card: public/hochaufloesende-satellitenbilder-downloaden-fernerkundung/twitter-card.jpg

17:42:13 PM: Generated Twitter Card: public/fernerkundung-und-bildklassifikation/twitter-card.jpg Generated Twitter Card: public/open-street-map-daten-als-shapefiles-downloaden/twitter-card.jpg

17:42:14 PM: Generated Twitter Card: public/qgis-kostenlos-lernen/twitter-card.jpg

17:42:14 PM: Generated Twitter Card: public/gis-software-kategorien-welche-arten-von-gis-software-gibt-es/twitter-card.jpg

17:42:15 PM: Generated Twitter Card: public/8-open-source-web-gis-anwendungen/twitter-card.jpg

17:42:15 PM: Generated Twitter Card: public/fme-lizenz-kostenlos-fur-den-privaten-gebrauch/twitter-card.jpg

17:42:15 PM: Generated Twitter Card: public/was-ist-ein-shapefile-shp-dbf-und-shx/twitter-card.jpg Generated Twitter Card: public/einfacher-download-fur-30-meter-srtm-tiles/twitter-card.jpg

17:42:16 PM: Generated Twitter Card: public/geo-und-gis-podcasts-um-auf-dem-aktuellen-stand-zu-bleiben/twitter-card.jpg

17:42:16 PM: Generated Twitter Card: public/gis-und-geo-datenbank-managementsystem-optionen/twitter-card.jpg Generated Twitter Card: public/gk-utm-koordinaten-umrechnen-transformationstool/twitter-card.jpg

17:42:17 PM: Generated Twitter Card: public/gis-und-augmented-reality-ar/twitter-card.jpg

17:42:17 PM: Generated Twitter Card: public/gis-freiwilligenarbeit-mit-gis-von-zuhause-die-welt-verbessern/twitter-card.jpg

17:42:17 PM: Generated Twitter Card: public/die-bekanntesten-geospatial-und-gis-influencers/twitter-card.jpg Generated Twitter Card: public/gehalt-und-jobs-in-der-gis-branche/twitter-card.jpg

17:42:18 PM: Generated Twitter Card: public/postgre-sql-mit-post-gis-installieren-und-in-qgis-einrichten/twitter-card.jpg

17:42:18 PM: Generated Twitter Card: public/web-feature-service-open-source-wfs/twitter-card.jpg

17:42:18 PM: Generated Twitter Card: public/wms-web-map-service-und-wmts/twitter-card.jpg Generated Twitter Card: public/geographie-und-gis-blogs/twitter-card.jpg

17:42:19 PM: Generated Twitter Card: public/gis-anwendungen-welche-gis-anwendungen-gibt-es/twitter-card.jpg

17:42:19 PM: Generated Twitter Card: public/gis-jobborsen-auf-der-suche-nach-einem-neuen-gis-job/twitter-card.jpg

17:42:19 PM: Generated Twitter Card: public/gis-vs-cad-der-unterschied-zwischen-gis-und-cad/twitter-card.jpg Generated Twitter Card: public/gis-firmen-und-gis-dienstleister-verzeichnis/twitter-card.jpg

17:42:20 PM: Generated Twitter Card: public/auto-cad-map-3-d-shapefile-export/twitter-card.jpg

17:42:20 PM: Generated Twitter Card: public/unigis-weiterbildung-geoinformatik/twitter-card.jpg Generated Twitter Card: public/gis-software-optionen-open-source-kostenlos-und-kostenpflichtig/twitter-card.jpg Generated Twitter Card: public/geodaten-deutschland-online-download-kostenlos/twitter-card.jpg

17:42:20 PM: Generated Twitter Card: public/geodatenmanager-weiterbildung-universitat-tubingen/twitter-card.jpg

17:42:20 PM: Generated Twitter Card: public/geodaten-was-sind-geodaten/twitter-card.jpg

17:42:21 PM: success run queries - 175.489s - 92/92 0.52/s

Environment (if relevant)

System:
    OS: Windows 10 10.0.18362
    CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  Binaries:
    Node: 10.16.0 - C:\Users\mdiet\AppData\Local\Temp\yarn--1580665326102-0.6438505110780024\node.CMD
    Yarn: 1.19.0 - C:\Users\mdiet\AppData\Local\Temp\yarn--1580665326102-0.6438505110780024\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.7.4
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    gatsby: ^2.19.12 => 2.19.12
    gatsby-image: ^2.2.40 => 2.2.40
    gatsby-plugin-catch-links: ^2.1.25 => 2.1.25
    gatsby-plugin-feed: ^2.3.27 => 2.3.27
    gatsby-plugin-gdpr-cookies: ^1.0.4 => 1.0.4
    gatsby-plugin-google-adsense: ^1.1.3 => 1.1.3
    gatsby-plugin-google-analytics: ^2.1.35 => 2.1.35
    gatsby-plugin-guess-js: ^1.1.30 => 1.1.30
    gatsby-plugin-htaccess: ^1.4.0 => 1.4.0
    gatsby-plugin-lodash: ^3.1.20 => 3.1.20
    gatsby-plugin-lunr: ^1.5.2 => 1.5.2
    gatsby-plugin-mailchimp: ^5.1.2 => 5.1.2
    gatsby-plugin-manifest: ^2.2.41 => 2.2.41
    gatsby-plugin-minify: ^0.2.0 => 0.2.0
    gatsby-plugin-nprogress: ^2.1.19 => 2.1.19
    gatsby-plugin-offline: ^3.0.34 => 3.0.34
    gatsby-plugin-react-helmet: ^3.1.22 => 3.1.22
    gatsby-plugin-react-leaflet: ^2.0.11 => 2.0.11
    gatsby-plugin-sass: ^2.1.28 => 2.1.28
    gatsby-plugin-sharp: ^2.4.5 => 2.4.5
    gatsby-plugin-sitemap: ^2.2.27 => 2.2.27
    gatsby-plugin-styled-components: ^3.1.19 => 3.1.19
    gatsby-plugin-twitter: ^2.1.19 => 2.1.19
    gatsby-remark-autolink-headers: ^2.1.24 => 2.1.24
    gatsby-remark-check-links: ^2.1.0 => 2.1.0
    gatsby-remark-copy-linked-files: ^2.1.37 => 2.1.37
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-remark-images: ^3.1.44 => 3.1.44
    gatsby-remark-mermaid: ^1.2.0 => 1.2.0
    gatsby-remark-prismjs: ^3.3.31 => 3.3.31
    gatsby-remark-relative-images: ^0.2.3 => 0.2.3
    gatsby-remark-responsive-iframe: ^2.2.32 => 2.2.32
    gatsby-remark-social-cards: ^0.4.1 => 0.4.1
    gatsby-source-filesystem: ^2.1.48 => 2.1.48
    gatsby-source-instagram: ^0.6.1 => 0.6.1
    gatsby-source-instagram-all: ^2.0.5 => 2.0.5
    gatsby-transformer-remark: ^2.6.50 => 2.6.50
    gatsby-transformer-sharp: ^2.3.14 => 2.3.14

File contents (if changed)

gatsby-config.js:

const urljoin = require("url-join");
const config = require("./data/SiteConfig");

require("dotenv").config({
  path: `.env.${process.env.NODE_ENV}`,
})

// datepicker
var nottoday = "2018-04-01"
var today = new Date().toISOString().slice(0,10);

const dynamicPlugins = []

module.exports = {
  pathPrefix: "/GIS-Netzwerk",
  siteMetadata: {
    siteUrl: urljoin(config.siteUrl, config.pathPrefix),
    rssMetadata: {
      site_url: urljoin(config.siteUrl, config.pathPrefix),
      feed_url: urljoin(config.siteUrl, config.pathPrefix, config.siteRss),
      title: config.siteTitle,
      description: config.siteDescription,
      image_url: `${urljoin(
        config.siteUrl,
        config.pathPrefix
      )}/logos/logo.png`,
      copyright: config.copyright
    }
  },
  plugins: [
    /*{
      resolve: `gatsby-plugin-guess-js`,
      options: {
        GAViewID: process.env.GA_VIEW_ID,
        minimumThreshold: 0.03,
        jwt: {
          client_email: process.env.CLIENT_EMAIL,
          private_key: process.env.PRIVATE_KEY,
        },
        period: {
          startDate: nottoday,
          endDate: today,
        },
      },
    },
    {
      resolve: `gatsby-source-google-analytics-reporting-api`,
      options: {
        email: process.env.CLIENT_EMAIL,
        key: process.env.PRIVATE_KEY,
        viewId: process.env.GA_VIEW_ID,
        startDate: nottoday,
      }
    },*/
    "gatsby-plugin-react-helmet",
    "gatsby-plugin-lodash",
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "assets",
        path: `${__dirname}/static/`
      }
    }, 
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "posts",
        path: `${__dirname}/content/`
      }
    },
    {
      resolve: `gatsby-plugin-styled-components`,
      options: {
        // Add any options here
      },
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: "gatsby-remark-autolink-headers",
          },
          {
            resolve: "gatsby-remark-social-cards",
          },
          {
            resolve: "gatsby-remark-responsive-iframe",
          },
          {
            resolve: "gatsby-remark-copy-linked-files",
          },
          {
            resolve: "gatsby-remark-mermaid",
          },
          {
            resolve: "gatsby-remark-external-links",
            options: {
              rel: "noopener"
            }
          },
          {
            resolve: "gatsby-remark-images",
            options: {
              maxWidth: 1240,
              withWebp: true,
              quality: 80,
              tracedSVG: true,
              loading: "lazy",
            }
          },
          {
            resolve: `gatsby-source-instagram-all`,
            options: {
              access_token: process.env.IG_TOKEN
            }
          },
          {
            resolve: `gatsby-remark-prismjs`,
            options: {
              // Class prefix for <pre> tags containing syntax highlighting;
              // defaults to 'language-' (eg <pre class="language-js">).
              // If your site loads Prism into the browser at runtime,
              // (eg for use with libraries like react-live),
              // you may use this to prevent Prism from re-processing syntax.
              // This is an uncommon use-case though;
              // If you're unsure, it's best to use the default value.
              classPrefix: "language-",
              // This is used to allow setting a language for inline code
              // (i.e. single backticks) by creating a separator.
              // This separator is a string and will do no white-space
              // stripping.
              // A suggested value for English speakers is the non-ascii
              // character '›'.
              inlineCodeMarker: null,
              // This lets you set up language aliases.  For example,
              // setting this to '{ sh: "bash" }' will let you use
              // the language "sh" which will highlight using the
              // bash highlighter.
              aliases: {},
              // This toggles the display of line numbers globally alongside the code.
              // To use it, add the following line in src/layouts/index.js
              // right after importing the prism color scheme:
              //  `require("prismjs/plugins/line-numbers/prism-line-numbers.css");`
              // Defaults to false.
              // If you wish to only show line numbers on certain code blocks,
              // leave false and use the {numberLines: true} syntax below
              showLineNumbers: false,
              // If setting this to true, the parser won't handle and highlight inline
              // code used in markdown i.e. single backtick code like `this`.
              noInlineHighlight: false,
            }
          },
        ]
      },
    },
    {
      resolve: `gatsby-plugin-google-adsense`,
      options: {
        publisherId: process.env.ADSENSE_ID
      },
    },
    {
      resolve: "gatsby-plugin-styled-components",
    },
    {
      resolve: 'gatsby-plugin-react-leaflet',
      options: {
        linkStyles: true // (default: true) Enable/disable loading stylesheets via CDN
      }
    },
    {
      resolve: `gatsby-plugin-sass`,
      options: {
        precision: 6,
      },
    },
    {
    resolve: `gatsby-plugin-react-leaflet`,
    },
    {
      resolve: 'gatsby-plugin-mailchimp',
      options: {
        endpoint: process.env.MAIL_CHIMP,
      },
    },
    {
      resolve: `gatsby-plugin-gdpr-cookies`,
      options: {
        googleAnalytics: {
          trackingId: process.env.GA_ID,
          // Setting this parameter is optional
          anonymize: true
        },
        facebookPixel: {
          pixelId: 'YOUR_FACEBOOK_PIXEL_ID'
        },
        // Defines the environments where the tracking should be available  - default is ["production"]
        environments: ['production', 'development']
      },
    },
    {
      resolve: `gatsby-plugin-google-analytics`,
      options: {
        trackingId: process.env.GA_ID,
        anonymize: true,
        head: false,
      },
    },
    {
      resolve: "gatsby-plugin-nprogress",
      options: {
        color: config.themeColor
      }
    },
    "gatsby-plugin-sharp",
    "gatsby-transformer-sharp",
    "gatsby-plugin-catch-links",
    "gatsby-plugin-twitter",
    "gatsby-plugin-sitemap",
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: "GIS-Netzwerk",
        short_name: "GIS-Netzwerk",

        start_url: "/",
        background_color: config.backgroundColor,
        theme_color: config.themeColor,
        // Enables "Add to Homescreen" prompt and disables browser UI (including back button)
        // see https://developers.google.com/web/fundamentals/web-app-manifest/#display
        display: "standalone",
        icon: "./static/logos/logo.png", // This path is relative to the root of the site.
      },
    },
    "gatsby-plugin-offline",
    {
      resolve: `gatsby-plugin-catch-links`,
    },
    {
      resolve: 'gatsby-plugin-lunr',
      options: {
        languages: [{ name: 'de' }],
        fields: [
          { name: 'title', store: true, attributes: { boost: 20 } },
          { name: 'content' },
          { name: 'url', store: true },
          { name: 'date', store: true }
        ],
        resolvers: {
          MarkdownRemark: {
            title: node => node.frontmatter.title,
            content: node => node.rawMarkdownBody,
            url: node => node.fields.slug,
            date: node => node.frontmatter.date
          },
        },
        filename: 'search_index.json',  },
    },
    {
      resolve: "gatsby-plugin-feed",
      options: {
        setup(ref) {
          const ret = ref.query.site.siteMetadata.rssMetadata;
          ret.allMarkdownRemark = ref.query.allMarkdownRemark;
          ret.generator = "GIS-Netzwerk";
          return ret;
        },
        query: `
        {
          site {
            siteMetadata {
              rssMetadata {
                site_url
                feed_url
                title
                description
                image_url
                copyright
              }
            }
          }
        }
      `,
        feeds: [
          {
            serialize(ctx) {
              const { rssMetadata } = ctx.query.site.siteMetadata;
              return ctx.query.allMarkdownRemark.edges.map(edge => ({
                categories: edge.node.frontmatter.tags,
                date: edge.node.fields.date,
                title: edge.node.frontmatter.title,
                description: edge.node.excerpt,
                url: rssMetadata.site_url + edge.node.fields.slug,
                guid: rssMetadata.site_url + edge.node.fields.slug,
                custom_elements: [
                  { "content:encoded": edge.node.html },
                  { author: config.userEmail }
                ]
              }));
            },
            query: `
            {
              allMarkdownRemark(
                limit: 1000,
                sort: { order: DESC, fields: [fields___date] },
              ) {
                edges {
                  node {
                    excerpt
                    html
                    timeToRead
                    fields {
                      slug
                      date
                    }
                    frontmatter {
                      title
                      cover
                      date
                      category
                      tags
                    }
                  }
                }
              }
            }
          `,
            output: config.siteRss
          }
        ]
      }
    }
  ].concat(dynamicPlugins)
};

package.json:

{
  "name": "GIS-Netzwerk",
  "description": "Geoinformatik, GIS, Web-Development.",
  "version": "0.1.2",
  "author": "Max Dietrich <max.dietrichk@gis-netzwerk.com",
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.26",
    "@fortawesome/free-brands-svg-icons": "^5.12.0",
    "@fortawesome/free-solid-svg-icons": "^5.12.0",
    "@fortawesome/react-fontawesome": "^0.1.8",
    "@palmabit/react-cookie-law": "^0.3.0",
    "algoliasearch": "^3.35.1",
    "apexcharts": "^3.15.3",
    "bootstrap": "^4.4.1",
    "catiline": "^2.9.3",
    "child_process": "^1.0.2",
    "dotenv": "^8.2.0",
    "eslint-plugin-flowtype": "^4.6.0",
    "fibers": "^4.0.2",
    "fs": "0.0.1-security",
    "gatsby": "^2.19.12",
    "gatsby-image": "^2.2.40",
    "gatsby-plugin-catch-links": "^2.1.25",
    "gatsby-plugin-feed": "^2.3.27",
    "gatsby-plugin-gdpr-cookies": "^1.0.4",
    "gatsby-plugin-google-adsense": "^1.1.3",
    "gatsby-plugin-google-analytics": "^2.1.35",
    "gatsby-plugin-guess-js": "^1.1.30",
    "gatsby-plugin-htaccess": "^1.4.0",
    "gatsby-plugin-lodash": "^3.1.20",
    "gatsby-plugin-lunr": "^1.5.2",
    "gatsby-plugin-mailchimp": "^5.1.2",
    "gatsby-plugin-manifest": "^2.2.41",
    "gatsby-plugin-minify": "^0.2.0",
    "gatsby-plugin-nprogress": "^2.1.19",
    "gatsby-plugin-offline": "^3.0.34",
    "gatsby-plugin-react-helmet": "^3.1.22",
    "gatsby-plugin-react-leaflet": "^2.0.11",
    "gatsby-plugin-sass": "^2.1.28",
    "gatsby-plugin-sharp": "^2.4.5",
    "gatsby-plugin-sitemap": "^2.2.27",
    "gatsby-plugin-styled-components": "^3.1.19",
    "gatsby-plugin-twitter": "^2.1.19",
    "gatsby-remark-autolink-headers": "^2.1.24",
    "gatsby-remark-check-links": "^2.1.0",
    "gatsby-remark-copy-linked-files": "^2.1.37",
    "gatsby-remark-external-links": "0.0.4",
    "gatsby-remark-images": "^3.1.44",
    "gatsby-remark-mermaid": "^1.2.0",
    "gatsby-remark-prismjs": "^3.3.31",
    "gatsby-remark-relative-images": "^0.2.3",
    "gatsby-remark-responsive-iframe": "^2.2.32",
    "gatsby-remark-social-cards": "^0.4.1",
    "gatsby-source-filesystem": "^2.1.48",
    "gatsby-source-instagram": "^0.6.1",
    "gatsby-source-instagram-all": "^2.0.5",
    "gatsby-transformer-remark": "^2.6.50",
    "gatsby-transformer-sharp": "^2.3.14",
    "googleapis": "^47.0.0",
    "jquery": "^3.4.1",
    "leaflet": "^1.6.0",
    "lodash": "^4.17.15",
    "moment": "^2.24.0",
    "net": "^1.0.2",
    "object-hash": "^2.0.1",
    "ogr2ogr": "^1.5.0",
    "ol": "^6.1.1",
    "prismjs": "^1.19.0",
    "proj4": "^2.6.0",
    "react": "^16.12.0",
    "react-accessible-accordion": "^3.0.1",
    "react-apexcharts": "^1.3.6",
    "react-bootstrap": "^1.0.0-beta.16",
    "react-bootstrap-sidebar": "0.0.1",
    "react-cookie-consent": "^3.0.0",
    "react-disqus-comments": "^1.4.0",
    "react-dom": "^16.12.0",
    "react-easy-swipe": "0.0.18",
    "react-helmet": "^5.2.1",
    "react-highlight-words": "^0.16.0",
    "react-instantsearch-dom": "^6.3.0",
    "react-leaflet": "^2.6.1",
    "react-leaflet-shapefile": "^2.0.0",
    "react-mailchimp-form": "^1.0.2",
    "react-navigation-header-buttons": "^3.0.4",
    "react-share": "^4.0.1",
    "react-spring": "^8.0.27",
    "react-twitter-widgets": "^1.7.1",
    "sass": "^1.25.0",
    "sharp": "^0.24.0",
    "shpjs": "^3.4.3",
    "styled-components": "^5.0.0",
    "tls": "0.0.1",
    "typescript": "^3.7.5",
    "url-join": "^4.0.1"
  },
  "devDependencies": {
    "cli-glob": "^0.1.0",
    "dotenv-webpack": "^1.7.0",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-config-prettier": "^6.10.0",
    "eslint-plugin-import": "^2.20.1",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.18.2",
    "gh-pages": "^2.2.0",
    "node-sass": "^4.13.1",
    "parcel-bundler": "^1.12.4",
    "prettier": "^1.19.1",
    "react-openlayers": "^0.3.0",
    "remark-cli": "^7.0.1",
    "remark-preset-lint-recommended": "^3.0.3",
    "sass-loader": "^8.0.2",
    "stylefmt": "^6.0.3",
    "stylelint": "^13.0.0",
    "stylelint-config-standard": "^19.0.0",
    "webpack": "^4.41.5",
    "write-good": "^1.0.2"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "main": "n/a",
  "scripts": {
    "develop": "gatsby develop",
    "deploy": "gatsby build --prefix-paths",
    "dev": "npm run develop",
    "serve": "gatsby serve",
    "build": "gatsby build",
    "build:pp": "gatsby build --prefix-paths",
    "build:gh": "npm run clean && npm run build:pp && gh-pages -d public",
    "clean": "rm -rf public && rm -rf .cache",
    "lint:js": "eslint --ext .js,.jsx .",
    "lint:md": "remark content/",
    "write-good": "write-good $(glob 'content/posts/**/*.md')",
    "format:js": "prettier '**/*.{js,jsx}' --write"
  },
  "remarkConfig": {
    "plugins": [
      "remark-preset-lint-recommended"
    ]
  }
}

gatsby-node.js:

/* eslint "no-console": "off" */

const path = require("path");
const _ = require("lodash");
const moment = require("moment");
const siteConfig = require("./data/SiteConfig");

exports.onCreateNode = ({ node, actions, getNode }) => {
  const { createNodeField } = actions;
  let slug;
  if (node.internal.type === "MarkdownRemark") {
    const fileNode = getNode(node.parent);
    const parsedFilePath = path.parse(fileNode.relativePath);
    if (
      Object.prototype.hasOwnProperty.call(node, "frontmatter") &&
      Object.prototype.hasOwnProperty.call(node.frontmatter, "title")
    ) {
      slug = `/${_.kebabCase(node.frontmatter.title)}`;
    } else if (parsedFilePath.name !== "index" && parsedFilePath.dir !== "") {
      slug = `/${parsedFilePath.dir}/${parsedFilePath.name}`;
    } else if (parsedFilePath.dir === "") {
      slug = `/${parsedFilePath.name}`;
    } else {
      slug = `/${parsedFilePath.dir}/`;
    }

    if (Object.prototype.hasOwnProperty.call(node, "frontmatter")) {
      if (Object.prototype.hasOwnProperty.call(node.frontmatter, "slug"))
        slug = `/${_.kebabCase(node.frontmatter.slug)}`;
      if (Object.prototype.hasOwnProperty.call(node.frontmatter, "date")) {
        const date = moment(node.frontmatter.date, siteConfig.dateFromFormat);
        if (!date.isValid)
          console.warn(`WARNING: Invalid date.`, node.frontmatter);

        createNodeField({
          node,
          name: "date",
          value: date.toISOString()
        });
      }
    }
    createNodeField({ node, name: "slug", value: slug });
  }
};

exports.createPages = async ({ graphql, actions }) => {
  const { createPage } = actions;
  const post = path.resolve("src/templates/post.jsx");
  const tagPage = path.resolve("src/templates/tag.jsx");
  const categoryPage = path.resolve("src/templates/category.jsx");

  const markdownQueryResult = await graphql(
    `
      {
        allMarkdownRemark {
          edges {
            node {
              fields {
                slug
              }
              frontmatter {
                layout
                title
                tags
                category
                date
                published
              }
            }
          }
        }
      }
    `
  );

  if (markdownQueryResult.errors) {
    console.error(markdownQueryResult.errors);
    throw markdownQueryResult.errors;
  }

  const tagSet = new Set();
  const categorySet = new Set();

  const postsEdges = markdownQueryResult.data.allMarkdownRemark.edges;

  postsEdges.sort((postA, postB) => {
    const dateA = moment(
      postA.node.frontmatter.date,
      siteConfig.dateFromFormat
    );

    const dateB = moment(
      postB.node.frontmatter.date,
      siteConfig.dateFromFormat
    );

    if (dateA.isBefore(dateB)) return 1;
    if (dateB.isBefore(dateA)) return -1;

    return 0;
  });

  postsEdges.forEach((edge, index) => {
    if (edge.node.frontmatter.tags) {
      edge.node.frontmatter.tags.forEach(tag => {
        tagSet.add(tag);
      });
    }

    if (edge.node.frontmatter.category) {
      categorySet.add(edge.node.frontmatter.category);
    }

    const nextID = index + 1 < postsEdges.length ? index + 1 : 0;
    const prevID = index - 1 >= 0 ? index - 1 : postsEdges.length - 1;
    const nextEdge = postsEdges[nextID];
    const prevEdge = postsEdges[prevID];

    if (edge.node.frontmatter.layout === 'post' && edge.node.frontmatter.published == "yes") { //post 
      createPage({
        path: edge.node.fields.slug,
        component: post,
        context: {
          slug: edge.node.fields.slug,
          category: edge.node.frontmatter.category,
          timetoread: edge.node.frontmatter.timetoread,
          tags: edge.node.frontmatter.tags,
          date: edge.node.frontmatter.date,
          nexttitle: nextEdge.node.frontmatter.title,
          nextslug: nextEdge.node.fields.slug,
          prevtitle: prevEdge.node.frontmatter.title,
          prevslug: prevEdge.node.fields.slug
        }
      });
    }
});

  tagSet.forEach(tag => {
    createPage({
      path: `/tags/${_.kebabCase(tag)}/`,
      component: tagPage,
      context: { tag }
    });
  });
};

gatsby-browser.js: N/A gatsby-ssr.js: N/A

benrobertsonio commented 4 years ago

Handling this on the cloud side :)