Gatsby: Running Gatsby build gives Error: 856328897 TypeError: promise.finally is not a function

Created on 27 Apr 2020  路  25Comments  路  Source: gatsbyjs/gatsby

Description

When I run gatsby build or npm install I get the error Error: 856328897 TypeError: promise.finally is not a function

Steps to reproduce

I was getting missing images when deploying to netlify so I cleaned my local install then started getting these errors when I runnpm install or gatsby build - https://github.com/payello/suggestions-2020 this is my repo.

How to Make a Minimal Reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/

Expected result

What should happen? The files should build as usual

Actual result

What happened.

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

System: OS: macOS 10.15.4 CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 12.13.0 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.12.0 - /usr/local/bin/npm Languages: Python: 2.7.12 - /Library/Frameworks/Python.framework/Versions/2.7/bin/python Browsers: Chrome: 81.0.4044.122 Firefox: 75.0 Safari: 13.1 npmPackages: gatsby: ^2.19.7 => 2.21.0 gatsby-image: ^2.2.39 => 2.4.0 gatsby-plugin-manifest: ^2.2.39 => 2.4.0 gatsby-plugin-offline: ^3.0.32 => 3.2.0 gatsby-plugin-react-helmet: ^3.1.21 => 3.3.0 gatsby-plugin-sharp: ^2.4.3 => 2.6.0 gatsby-plugin-styled-components: ^3.2.1 => 3.3.0 gatsby-source-contentful: ^2.2.7 => 2.3.0 gatsby-source-filesystem: ^2.1.46 => 2.3.0 gatsby-transformer-sharp: ^2.3.13 => 2.5.0

needs reproduction bug

Most helpful comment

Reverted to 2.20.28 and it fixed my issue as well.

All 25 comments

I ran into the same issue and had to revert my gatsby package to 2.20.28. Everything works as expected for me with that version. There was a 'promise.finally' added to 'packages/gatsby/src/query/query-runner.js` in version 2.20.29 (4-22). I believe that was the issue for me.

Reverted to 2.20.28 and it fixed my issue as well.

Me too thank you @timbiles!

Hi @payello !

Sorry to hear you're running into an issue. But the repo you linked (https://github.com/payello/suggestions-2020) doesn't exist. Is it a private repo?

To help us best begin debugging the underlying cause, it is incredibly helpful someone is able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

Thanks for using Gatsby! 馃挏

Also, please make sure you are using Node version > 10.13.0 in your builds. As this is the minimal supported version.

Also, please make sure you are using Node version > 10.13.0 in your builds. As this is the minimal supported version.

Hey @vladar Thanks for responding to this issue! The client I am working with is using Node v12.9.1, and we are still running into the same error as @payello with the current gatsby version.

Hi @vladar , thanks for your reply.

Is it a private repo?

It was a private repo yes. I have forced the version of Gatsby in the repo to 2.20.28 and it is working now on master branch. I have only recently made the repo public. I am using Node - v12.13.0 and NPM - 6.12.0.

I've stripped back all of my components but was not able to run gatsby build at all when in Gatsby 2.20.29 - see branch issue-23542 in the above repo

Let me know if I can help further

Thanks!

@payello Sadly, I can't reproduce it with your project (neither with [email protected] nor with 2.21.1). Also, there is no branch issue-23542 (did you forget to push it?)

@timbiles Can you provide access to your project or create a minimal reproduction?

So far the only idea I have is that core-js shim replaces native promise implementation somehow (same as in https://github.com/zloirock/core-js/issues/749)

But I need to reproduce it.

What you can try in the meantime: upgrade global gatsby-cli package, remove node_modules and re-install dependencies.

Reverting back to 2.20.28 worked for me too!

I had just started a new project with gatsby new restaurant-gatsby and after that did gatsby develop and got the same error.

 TypeError: promise.finally is not a function

  - query-runner.js:60 graphql
    [restaurant-gatsby]/[gatsby]/dist/query/query-runner.js:60:20

  - query-runner.js:73 module.exports
    [restaurant-gatsby]/[gatsby]/dist/query/query-runner.js:73:20

  - queue.js:32 Worker.handler [as fn]
    [restaurant-gatsby]/[gatsby]/dist/query/queue.js:32:43

  - worker.js:69 Worker.start
    [restaurant-gatsby]/[better-queue]/lib/worker.js:69:29

  - queue.js:701 Queue._startBatch
    [restaurant-gatsby]/[better-queue]/lib/queue.js:701:12

  - queue.js:567
    [restaurant-gatsby]/[better-queue]/lib/queue.js:567:12

  - better-queue-custom-store.js:180 Object.getLock
    [restaurant-gatsby]/[gatsby]/dist/query/better-queue-custom-store.js:180:7

  - queue.js:533
    [restaurant-gatsby]/[better-queue]/lib/queue.js:533:17

  - better-queue-custom-store.js:128 Object.takeFirstN
    [restaurant-gatsby]/[gatsby]/dist/query/better-queue-custom-store.js:128:7

  - queue.js:473 Queue._getNextBatch
    [restaurant-gatsby]/[better-queue]/lib/queue.js:473:54

  - queue.js:530 Queue._processNext
    [restaurant-gatsby]/[better-queue]/lib/queue.js:530:8

  - queue.js:520
    [restaurant-gatsby]/[better-queue]/lib/queue.js:520:12

  - queue.js:26 Queue.self.precondition
    [restaurant-gatsby]/[better-queue]/lib/queue.js:26:60

  - queue.js:511 Queue._processNextIfAllowed
    [restaurant-gatsby]/[better-queue]/lib/queue.js:511:8

  - queue.js:484 Immediate.<anonymous>
    [restaurant-gatsby]/[better-queue]/lib/queue.js:484:12

  - timers.js:439 processImmediate
    internal/timers.js:439:21

Output of gatsby info --clipboard is below

  System:
    OS: macOS 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
    Shell: 3.0.2 - /usr/local/bin/fish
  Binaries:
    Node: 12.8.0 - /usr/local/bin/node
    npm: 6.10.2 - /usr/local/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.122
    Firefox: 75.0
    Safari: 12.0.3
  npmPackages:
    gatsby: ^2.21.0 => 2.21.0
    gatsby-image: ^2.4.0 => 2.4.0
    gatsby-plugin-manifest: ^2.4.0 => 2.4.0
    gatsby-plugin-offline: ^3.2.0 => 3.2.0
    gatsby-plugin-react-helmet: ^3.3.0 => 3.3.0
    gatsby-plugin-sharp: ^2.6.0 => 2.6.0
    gatsby-source-filesystem: ^2.3.0 => 2.3.0
    gatsby-transformer-sharp: ^2.5.0 => 2.5.0
  npmGlobalPackages:
    gatsby-cli: 2.4.15

I had just started a new project with gatsby new restaurant-gatsby and after that did gatsby develop and got the same error.

 TypeError: promise.finally is not a function

  - query-runner.js:60 graphql
    [restaurant-gatsby]/[gatsby]/dist/query/query-runner.js:60:20

  - query-runner.js:73 module.exports
    [restaurant-gatsby]/[gatsby]/dist/query/query-runner.js:73:20

  - queue.js:32 Worker.handler [as fn]
    [restaurant-gatsby]/[gatsby]/dist/query/queue.js:32:43

  - worker.js:69 Worker.start
    [restaurant-gatsby]/[better-queue]/lib/worker.js:69:29

  - queue.js:701 Queue._startBatch
    [restaurant-gatsby]/[better-queue]/lib/queue.js:701:12

  - queue.js:567
    [restaurant-gatsby]/[better-queue]/lib/queue.js:567:12

  - better-queue-custom-store.js:180 Object.getLock
    [restaurant-gatsby]/[gatsby]/dist/query/better-queue-custom-store.js:180:7

  - queue.js:533
    [restaurant-gatsby]/[better-queue]/lib/queue.js:533:17

  - better-queue-custom-store.js:128 Object.takeFirstN
    [restaurant-gatsby]/[gatsby]/dist/query/better-queue-custom-store.js:128:7

  - queue.js:473 Queue._getNextBatch
    [restaurant-gatsby]/[better-queue]/lib/queue.js:473:54

  - queue.js:530 Queue._processNext
    [restaurant-gatsby]/[better-queue]/lib/queue.js:530:8

  - queue.js:520
    [restaurant-gatsby]/[better-queue]/lib/queue.js:520:12

  - queue.js:26 Queue.self.precondition
    [restaurant-gatsby]/[better-queue]/lib/queue.js:26:60

  - queue.js:511 Queue._processNextIfAllowed
    [restaurant-gatsby]/[better-queue]/lib/queue.js:511:8

  - queue.js:484 Immediate.<anonymous>
    [restaurant-gatsby]/[better-queue]/lib/queue.js:484:12

  - timers.js:439 processImmediate
    internal/timers.js:439:21

Output of gatsby info --clipboard is below

  System:
    OS: macOS 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
    Shell: 3.0.2 - /usr/local/bin/fish
  Binaries:
    Node: 12.8.0 - /usr/local/bin/node
    npm: 6.10.2 - /usr/local/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.122
    Firefox: 75.0
    Safari: 12.0.3
  npmPackages:
    gatsby: ^2.21.0 => 2.21.0
    gatsby-image: ^2.4.0 => 2.4.0
    gatsby-plugin-manifest: ^2.4.0 => 2.4.0
    gatsby-plugin-offline: ^3.2.0 => 3.2.0
    gatsby-plugin-react-helmet: ^3.3.0 => 3.3.0
    gatsby-plugin-sharp: ^2.6.0 => 2.6.0
    gatsby-source-filesystem: ^2.3.0 => 2.3.0
    gatsby-transformer-sharp: ^2.5.0 => 2.5.0
  npmGlobalPackages:
    gatsby-cli: 2.4.15

I had uninstalled the gatsby-cli and installed again and then created the project again. It is working fine.

npm uninstall -g gatsby-cli
npm install -g gatsby-cli

Yeah, that's what I thought. Old gatsby-cli probably includes older babel preset with this core-js polyfill which overrides promise.finally.

Hey! I have the exact same issue here. Did you find a solution except downgrade the gatsby version? Thank you 馃檹

@guillaumebriday Did you try to upgrade global gatsby-cli version (and maybe local too)?

@vladar hey! I don鈥檛 use the global version.

You can see the logs here: https://app.netlify.com/sites/guillaumebriday/deploys/5eaf832c5d2bc500069303f7

And the repo here: https://github.com/guillaumebriday/guillaumebriday.fr

I hope it could help! 馃

@guillaumebriday I didn't think I used gatsby-cli globally either, but when I uninstalled the package, and installed it again the upgraded gatsby version started working for me.

so what @nabendu82 used.

npm uninstall -g gatsby-cli
npm install -g gatsby-cli

Seeing the same issue running gatsby develop. Reinstalled gatsby-cli globally, removed node_modules and reinstalled - and no improvement.

Downgraded to 2.20.28 and the issue was resolved.

I was seeing this on Netlify deploy builds (worked fine locally and not using global gatsby-cli) and noticed they default to an ancient version of Yarn (v1.3.2). I set the YARN_VERSION environment variable to 1.22.4 in my Netlify site deploy settings and then it worked. Could be an issue with yarn.lock processing between the different Yarn versions or something, who knows. Anecdotal at best, but thought I'd leave it here in case it helps someone.

I do have yarn 1.22.4, and it does not work :/

I had this error message as well, but only when doing gatsby develop directly. When doing "npm start"(which runs "gatsby develop" locally, not globally) it worked without error messages.

I then updated from 2.20.29 to 2.21.20 in package.json; no change. Same behavior as with 2.20.29.

I then updated global cli as mentioned above to latest; this fixed the error. I can now also do gatsby develop directly.

This confirms that global cli was to blame. I had a global cli version likely from start to mid 2019, didn't check.

Yeah! I succeeded to build by removing gatsby-cli npm uninstall -g gatsby-cli on local and using YARN_VERSION in netlify as @wKovacs64 suggested.

As activity here has gone quiet, I'm going to assume that one of the fixes above or upgrades to either gatsby, yarn, or other libraries has everyone resolved and doing their best work! :)

If anyone is still stuck with this same error, please re-open this issue with updated environment information and a minimum reproduction. 馃挏

getting TypeError: promise.finally is not a function on gatsby build using [email protected]

I got it resolved by downgrading my gatsby version to 2.20.28

This worked for me

npm uninstall -g gatsby-cli
npm install -g gatsby-cli
Was this page helpful?
0 / 5 - 0 ratings

Related issues

totsteps picture totsteps  路  3Comments

signalwerk picture signalwerk  路  3Comments

magicly picture magicly  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

KyleAMathews picture KyleAMathews  路  3Comments