hoodie-server icon indicating copy to clipboard operation
hoodie-server copied to clipboard

UnhandledPromiseRejectionWarning: Conflict: Store already exists

Open pmbanugo opened this issue 6 years ago • 5 comments

When I start the hoodie server and my React client app, I call the account.signUp and everything works fine. If the user exists, it shows an error in the client. But then if I refresh the page (for now I just have a single page for sign-up and within it I initialise @hoodie-client) or I restart the client dev server, and then try making similar calls I get the following warning in the console

node:16033) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Conflict: Store already exists

If I add process.on('unhandledRejection', (error) => console.log(error.stack)); to my code, it shows this

Conflict: Store already exists
    at hoodieError (/Users/pmbanugo/Documents/projects/Personal Projects/LanguageApp/backend/node_modules/@hoodie/store-server-api/utils/errors.js:4:15)
    at Object.<anonymous> (/Users/pmbanugo/Documents/projects/Personal Projects/LanguageApp/backend/node_modules/@hoodie/store-server-api/utils/errors.js:17:27)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/pmbanugo/Documents/projects/Personal Projects/LanguageApp/backend/node_modules/@hoodie/store-server-api/store/create.js:9:14)

But it still creates the User Account.

I tried starting the server, then the client. I opened it in two separate browser and made the same call and got no such warning on the server. But then if I refresh the page or restart the client dev server, the error pops up

pmbanugo avatar Jul 18 '17 20:07 pmbanugo

what is the error you see in the browser? Does it occur after you sign in, or only if you try to sign up with a username that already exists? Make sure you have the latest version of @hoodie/store-client locally, you should have v8.1.2, you can check it with hoodie ls @hoodie/store-client.

For the Server error (UnhandledPromiseRejectionWarning), it would be helpful to have minimal sample an app, ideally without using react, which we can use the reproduce the error. You can also try to re-create the problem on glitch.com, you can use my app here as template: https://glitch.com/edit/#!/hoodie and remix it

gr2m avatar Jul 18 '17 20:07 gr2m

I have @hoodie/client version 10.1.0. I downloaded all hours before reporting. I didn't try to sign-in. Just sign-up then I noticed the error and tried to know when it happens.

It doesn't throw any error on the client. It registers successfully. I see the error on the server after a successful account creation

{ id: 'ry9ks6y',
  username: '[email protected]',
  roles: [],
  profile: undefined,
  createdAt: '2017-07-18T15:51:55.352Z',
  signedUpAt: '2017-07-18T20:32:33.594Z' }

Conflict: Store already exists
    at hoodieError (/Users/pmbanugo/Documents/projects/Personal Projects/LanguageApp/backend/node_modules/@hoodie/store-server-api/utils/errors.js:4:15)
    at Object.<anonymous> (/Users/pmbanugo/Documents/projects/Personal Projects/LanguageApp/backend/node_modules/@hoodie/store-server-api/utils/errors.js:17:27)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/pmbanugo/Documents/projects/Personal Projects/LanguageApp/backend/node_modules/@hoodie/store-server-api/store/create.js:9:14)

pmbanugo avatar Jul 18 '17 21:07 pmbanugo

there is no version 10.1.0 of @hoodie/store-client. Could you paste me the output of npm ls | grep hoodie?

gr2m avatar Jul 18 '17 21:07 gr2m

I meant version 10.1.0 of @hoodie/client.

this command didn't work hoodie ls @hoodie/store-client.

Running npm ls | grep hoodie gives:

│ ├─┬ @hoodie/[email protected]
│ ├─┬ @hoodie/[email protected]
│ ├─┬ @hoodie/[email protected]
│ ├─┬ @hoodie/[email protected]
│ │ ├── [email protected]

pmbanugo avatar Jul 18 '17 22:07 pmbanugo

okay but you have @hoodie/[email protected] so it’s not the problem I had in mind. Could you tell me the answer to this question?

Does it occur after you sign in, or only if you try to sign up with a username that already exists?

and

For the Server error (UnhandledPromiseRejectionWarning), it would be helpful to have minimal sample an app, ideally without using react, which we can use the reproduce the error. You can also try to re-create the problem on glitch.com, you can use my app here as template: https://glitch.com/edit/#!/hoodie and remix it

gr2m avatar Jul 18 '17 22:07 gr2m