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

config.get is not a function #1699

Closed
PatrickGeyer opened this issue Jun 3, 2019 · 5 comments · Fixed by #1701
Closed

config.get is not a function #1699

PatrickGeyer opened this issue Jun 3, 2019 · 5 comments · Fixed by #1701

Comments

@PatrickGeyer
Copy link

PatrickGeyer commented Jun 3, 2019

Expected Behavior

bit link should work without error

Actual Behavior

Step #1 - "build app": The command '/bin/sh -c yes "n" | bit link' returned a non-zero code: 1
Step #1 - "build app": at PromiseSpawn._promiseFulfilled (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/generators.js:97:49)
Step #1 - "build app": at Generator.tryCatcher (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/util.js:16:23)
Step #1 - "build app": at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:114:21)
Step #1 - "build app": at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:296:22)
Step #1 - "build app": at tryCatch (/usr/local/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:62:40)
Step #1 - "build app": at _callee2$ (/usr/local/lib/node_modules/bit-bin/dist/extensions/extensions-loader.js:150:25)
Step #1 - "build app": at _load_logger (/usr/local/lib/node_modules/bit-bin/dist/extensions/extensions-loader.js:52:43)
Step #1 - "build app": at require (/usr/local/lib/node_modules/bit-bin/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
Step #1 - "build app": at Module.require (internal/modules/cjs/loader.js:637:17)
Step #1 - "build app": at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Step #1 - "build app": at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Step #1 - "build app": at Module.load (internal/modules/cjs/loader.js:599:32)
Step #1 - "build app": at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Step #1 - "build app": at Module._compile (/usr/local/lib/node_modules/bit-bin/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
Step #1 - "build app": at Object.<anonymous> (/usr/local/lib/node_modules/bit-bin/dist/logger/logger.js:76:94)
Step #1 - "build app": at getSync (/usr/local/lib/node_modules/bit-bin/dist/api/consumer/lib/global-config.js:196:20)
Step #1 - "build app": TypeError: config.get is not a function
Step #1 - "build app": at processImmediate (timers.js:649:5)
Step #1 - "build app": at tryOnImmediate (timers.js:667:5)
Step #1 - "build app": at runCallback (timers.js:696:18)
Step #1 - "build app": at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/async.js:17:14)
Step #1 - "build app": at Async._drainQueues (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/async.js:147:5)
Step #1 - "build app": at _drainQueue (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/async.js:131:9)
Step #1 - "build app": at _drainQueueStep (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/async.js:138:12)
Step #1 - "build app": at Promise._settlePromises (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/promise.js:699:18)
Step #1 - "build app": at Promise._settlePromise0 (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/promise.js:619:10)
Step #1 - "build app": at Promise._settlePromise (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/promise.js:579:26)
Step #1 - "build app": at PromiseSpawn._promiseFulfilled (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/generators.js:97:49)
Step #1 - "build app": at Generator.tryCatcher (/usr/local/lib/node_modules/bit-bin/node_modules/bluebird/js/release/util.js:16:23)
Step #1 - "build app": at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:114:21)
Step #1 - "build app": at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:296:22)
Step #1 - "build app": at tryCatch (/usr/local/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:62:40)
Step #1 - "build app": at _callee2$ (/usr/local/lib/node_modules/bit-bin/dist/api/consumer/lib/global-config.js:73:26)

In the last day, bit started throwing the above error when running bit link. I'm installing bit-bin and running bit link as part of a Dockerfile, which has not changed. This makes me think that the issue arrived in the 14.1.2 version of bit pushed 14 hours ago. If I revert to 14.0.1 I do not get this error.

One thing I should note is that the command works fine on my local workstation in both versions, when bit is logged in or after I run the bit logout command. It's only in Docker that the command failed.

Dockerfile:

# base image
FROM node:10.7.0

RUN npm install -g bit-bin --unsafe-perm

# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
WORKDIR /tmp
COPY package.json package.json
# Copy shared bit dependencies so that npm install can run successfully
COPY src/shared src/shared

RUN npm config set '@bit:registry' https://node.bitsrc.io
RUN npm install

# Copy installed modules to app folder
RUN mkdir /app && cp -a /tmp/node_modules /app/

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# From here we load our application's code in, therefore the previous docker
# "layer" thats been cached will be used if possible
WORKDIR /app
COPY . /app

# THIS IS THE COMMAND THAT FAILS WITH NEW BIT VERSION
RUN yes "n" | bit link

# expose the port the app runs on
EXPOSE 8080

# start app
CMD ["npm", "run", "start:prod"]

Steps to Reproduce the Problem

  1. Install bit newest version: 14.1.2
  2. Run bit link
  3. See error

Specifications

  • Bit version:[email protected]
  • Node version:
  • npm / yarn version:
  • Platform:
  • Bit compiler (include version):
  • Bit tester (include version):
@itaymendel
Copy link
Contributor

itaymendel commented Jun 3, 2019

Hi @PatrickGeyer , thanks for the report!
We're looking into it right now. It's still safe to use the previous version of Bit if the issue does not reproduce.

I'm unable to reproduce the error.
Can you please provide additional information on the docker env and your workstation env? which node version and OS each of them runs....

@GiladShoham
Copy link
Member

@PatrickGeyer I found the root cause of the issue.
It's a result of a new config - logs format.
It's trying to load the config, but since it's a clean env completely the global config doesn't exist yet.
I'm working on a hotfix and it will be released later today.
meantime you can try set something in the config on your dockerfile or downgrade to 14.1.1.

@PatrickGeyer
Copy link
Author

@GiladShoham, sounds great - thanks for the speedy response. Love Bit!

@GiladShoham
Copy link
Member

@PatrickGeyer
I'm working on the fix.
But actually regradless the fix I would suggest you to replace
RUN yes "n" | bit link
by

RUN bit config set error_reporting true
RUN bit config set analytics_reporting false
RUN bit link

That's a better and more readable way to do it.
(It will also solve your problem for now..)

@GiladShoham
Copy link
Member

@PatrickGeyer A quick update.
A new dev version containing the fix is released to npm.
You can install it by npm i -g bit-bin@dev.
It will be published to production in a day or two.
The current dev version is safe to install at the moment.
(Might be not safe in a day or two to use the dev version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants