Accounts.config.defaultFieldSelector does not work as expected in Meteor 3

In meteor 2.x I used Accounts.config.defaultFieldSelector as shown here: Users and Accounts | Meteor Guide. But in version 3 I find this config doesnt seem to work. Is that expected? What should I use instead?

1 Like

Have you checked these docs for version 3: Accounts | Docs
Basically, the concept is the same in both version, the difference is every API which works with database is async instead of sync as it is in v2.

I have had several runs at the documentation and the code but I cant see an obvious problem. Ive made a POC here: GitHub - mattsouth/meteor-vue-3.2: POC for issue with Accounts.config which is a skeleton vue project with accounts-password. If you authenticate via the webdev console with Meteor.loginWithPassword('user', 'changeme') then the page should update with your username and favourite colour (blue). the username works the colours doesnt. colour is a custom attribute on the user object that should be available as its enabled with the Accounts.config block at the top of /server/main.js however, its not available on the client which you can confirm with Meteor.user() at the console.

I wasnt able to recreate this issue using blaze, so I now suspect the issue is isolated to vue / meteor-vite.

Got the same problem with react. Is this issue known to the developers?

I created this issue: Possible problem with Accounts.config · Issue #337 · JorgenVatle/meteor-vite · GitHub

In my case i could solve it. I had the config part in Meteor.startup(() => {Accounts.config… which worked fine with meteor v2. For meteor v3 i had put the config call before outside of Meteor.startup and its working fine now.

Ive always had the config outside of Meteor.startup, see the replication of the issue here: meteor-vue-3.2/server/main.js at main · mattsouth/meteor-vue-3.2 · GitHub. Is there any other change you made?

No nothing else, this was the only change.

using meteor version 3.1.2 and accounts-base 3.0.4 . maybe it is a new bug in accounts-base 3.1.0

ok, thanks for the clarification. I can confirm that if I move the Accounts.config block into the Meteor.startup function call then it is ignored for blaze too. Ive also done some investigations and can see that this issue appears to have been introduced when meteor-vite upgraded from vite@3 to vite@6.

1 Like