gatsby-source-filesystem breaks in v2.0.40

Created on 18 Jun 2019  路  8Comments  路  Source: gatsbyjs/gatsby

I'm going through the gatsby tutorial, and I got stuck on the Source Plugins section (https://www.gatsbyjs.org/tutorial/part-five/), as including the gatsby-source-fileystem stops compilation with the following message:

>gatsby develop
success open and validate gatsby-configs - 0.013 s
error Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and
asynchronous tasks in the componentWillUnmount method.

error UNHANDLED REJECTION


  TypeError: Cannot read property 'startTime' of undefined

  - reporter.js:29 generateActivityFinishedText
    [tutorial-part-four]/[gatsby]/[gatsby-cli]/lib/reporter/reporters/ink/reporter.js:29:74

  - reporter.js:76 Object.end
    [tutorial-part-four]/[gatsby]/[gatsby-cli]/lib/reporter/reporters/ink/reporter.js:76:24

  - index.js:116 Object.end
    [tutorial-part-four]/[gatsby]/[gatsby-cli]/lib/reporter/index.js:116:18

  - index.js:134
    [tutorial-part-four]/[gatsby]/dist/bootstrap/index.js:134:14

  - Generator.next

If I install version 2.0.39, it works fine.

(macOS, installed everything from scratch today...)

Most helpful comment

This may be related to #14875

All 8 comments

@mo-seph what version of gatsby? 2.9.4? have you got class or function component?
i have de same problem and any post do that : https://github.com/material-components/material-components-web-react/issues/434
But i haven't class... Try this if you always have problem!

This may be related to #14875

@jaredsilver quite possibly - I did end up installing gatsby-cli separately

It looks like this should be fixed in #14881

@mo-seph So the PR Jared mentioned has been merged and published as gatsby-source-filesystem 2.0.42. Could you try updating the dependency and see if this fixes the issue you are getting?

Should be fixed.

If this is not the case, or if we can help further--please don鈥檛 hesitate to reach out or comment on this issue, and we鈥檇 love to take another look.

Thanks for using Gatsby 馃挭

@wardpeet I encountered it while working on a plugin.
reporter is undefined in onRenderBody in gatsby-ssr.js even tho TypeScript types suggest otherwise and it seems to be used in gatsby-plugin-perf-metrics/gatsby-ssr.js#L4
Yet if I understand the source correct it's never passed develop-static-entry.js#L82 / static-entry.js#L326.
Would be great to be able to use reporter in SSR APIs as well 馃憤

I've also tried using reporter from gatsby-ssr.js to override the default logger of a package using its built-in setLoggerInstance method:

import {
  setLoggerInstance,
  StyleInjectorProvider,
  VirtualStyleInjector,
} from 'glaze';
import React from 'react';

import { wrapRootElement as wrapClientRootElement } from './gatsby-browser';

const injectorsByPathname = new Map();

export const wrapRootElement = ({ element, pathname, ...args }) => {
  console.log(args);
  const injector = new VirtualStyleInjector();
  injectorsByPathname.set(pathname, injector);

  return <>{wrapClientRootElement({ element })}</>;
};

export const onRenderBody = ({ setHeadComponents, pathname, reporter }) => {
  setLoggerInstance(reporter);

  const injector = injectorsByPathname.get(pathname);
  if (injector) {
    setHeadComponents(injector.getStyleElement());
    injectorsByPathname.delete(pathname);
  }
};

Is there a way to overcome this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  路  3Comments

hobochild picture hobochild  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

andykais picture andykais  路  3Comments