Skip to content

Commit

Permalink
Crash example app on user creation
Browse files Browse the repository at this point in the history
Add accounts-password and bcrypt (native)
Add feature to call Accounts#createUser on click
  • Loading branch information
GuestInCorle committed Jul 30, 2019
1 parent cbbdeba commit 27649d9
Show file tree
Hide file tree
Showing 13 changed files with 724 additions and 183 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# DEMO ONLY

This is a fork for bug demonstration only.

Application silently crashes when Accounts#createUser is called.

Manual debugging shows that Meteor's Future fails to resolve result from previously called `bcrypt.hash` function. See line 90 at [debugger snapshot](img/snapshot.png).

![Debugger snapshot](img/snapshot.png)

Steps to reproduce:

1. Run `docker-compose up --build -d` from `/example` directory. Note that app can start too early to connect to MongoDB with success, so just restart its container if app hangs up.
2. Open [app root](http://localhost) in the browser.
3. Click on the "Recreate user" button.

That's it. App successfully crashed. 😊

Crashed container log does not contain line:
```
---> user created with id: <some_mongo_id>
```

You can debug this app's server code by adding `debugger` word where you need a breakpoint.
Also see [breakpoint](example/app/server/main.js) at line 12 used to make [snapshot](img/snapshot.png).

You can patch this bug by `meteor npm uninstall bcrypt` command.
Thus Meteor will use pure JS bcrypt instead of native C++ version.

It seems that the build pipeline of the base Docker image was broken somewhere.

# Base Docker Image for Meteor Apps

This repo contains a base Docker image for use by [Meteor](https://www.meteor.com/) apps built using a [multistage Dockerfile](https://docs.docker.com/develop/develop-images/multistage-build/). You might want to use this base because:
Expand Down
2 changes: 1 addition & 1 deletion example/app-with-native-dependencies.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh \
# Start app
ENTRYPOINT ["/docker/entrypoint.sh"]

CMD ["node", "main.js"]
CMD ["node", "--inspect=0.0.0.0:9229", "main.js"]
3 changes: 2 additions & 1 deletion example/app/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ shell-server@0.4.0 # Server-side component of the `meteor shell` comm

autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
underscore@1.0.10
accounts-password@1.5.1
accounts-ui@1.3.1
21 changes: 18 additions & 3 deletions example/app/.meteor/versions
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
accounts-base@1.4.4
accounts-password@1.5.1
accounts-ui@1.3.1
accounts-ui-unstyled@1.4.2
allow-deny@1.1.0
autopublish@1.0.7
autoupdate@1.6.0
babel-compiler@7.3.4
babel-runtime@1.3.0
base64@1.0.11
base64@1.0.12
binary-heap@1.0.11
blaze@2.3.3
blaze-html-templates@1.1.2
Expand All @@ -16,6 +20,7 @@ check@1.3.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.3.0
deps@1.0.12
diff-sequence@1.1.1
Expand All @@ -25,6 +30,7 @@ ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.8.0
ecmascript-runtime-server@0.7.1
ejson@1.1.0
email@1.2.3
es5-shim@4.8.0
fetch@0.1.1
geojson-utils@1.0.10
Expand All @@ -36,7 +42,9 @@ insecure@1.0.7
inter-process-messaging@0.1.0
jquery@1.11.11
launch-screen@1.1.1
less@2.8.0
livedata@1.0.18
localstorage@1.2.0
logging@1.1.20
meteor@1.9.3
meteor-base@1.4.0
Expand All @@ -48,23 +56,30 @@ mobile-status-bar@1.0.14
modern-browsers@0.1.4
modules@0.13.0
modules-runtime@0.10.3
mongo@1.6.2
mongo@1.6.3
mongo-decimal@0.1.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-bcrypt@0.9.3
npm-mongo@3.1.2
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.11.2
random@1.1.0
rate-limit@1.0.9
reactive-dict@1.3.0
reactive-var@1.0.11
reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
service-configuration@1.0.11
session@1.2.0
sha@1.0.9
shell-server@0.4.0
socket-stream-client@0.2.2
spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.12
standard-minifier-css@1.5.3
standard-minifier-js@2.4.1
templating@1.3.2
Expand All @@ -74,5 +89,5 @@ templating-tools@1.1.2
tracker@1.2.0
ui@1.0.13
underscore@1.0.10
webapp@1.7.3
webapp@1.7.4
webapp-hashing@1.0.9
5 changes: 3 additions & 2 deletions example/app/client/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
</head>

<body>
{{> loginButtons}}

<h1>Welcome to Meteor!</h1>

{{> hello}}
{{> info}}
</body>

<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
<button>Recreate user</button>
</template>

<template name="info">
Expand Down
23 changes: 9 additions & 14 deletions example/app/client/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import {Meteor} from 'meteor/meteor';
import {Accounts} from 'meteor/accounts-base';
import {Template} from 'meteor/templating';

import './main.html';

Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});

Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY',
});

Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
instance.counter.set(instance.counter.get() + 1);
'click button'() {
Meteor.call('recreateUser', function () {
console.log(arguments);
});
},
});
Loading

0 comments on commit 27649d9

Please sign in to comment.