These are chat archives for reactioncommerce/reaction

24th
Mar 2015
Bogi
@boboci9
Mar 24 2015 14:59

Hi Aaron, when I try to add an address on the checkout page with the current development version I get

Sanitized and reported to the client as: Shop must be a valid alphanumeric ID [400]
I20150324-16:49:05.214(2)? 
I20150324-16:49:05.224(2)? Exception while invoking method 'addressBookAdd' Error: Shop must be a valid alphanumeric ID

Did anyone else have this issue?

Aaron Judd
@aaronjudd
Mar 24 2015 15:35

@boboci9 nope I am not seeing that.
however, I'm trying to track an elusive error occurring sporadically on checkout - where iron-router seems to die the first time you hit checkout..

Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?

Could be related, if you see this message before you try to add address, it could be that Shops is not subscribed.

Everest Liu
@evliu
Mar 24 2015 16:05
i’m hitting that iron-router error too, it’s not been fun -_-
i get it with the checkout page, and if i reload it enough, it eventually loads, but then it could also go back to the blank page if it reloads
Aaron Judd
@aaronjudd
Mar 24 2015 16:25
strangely - I almost never see it locally - but when I deployed on docker - I see it every time entering checkout, accompanied with a websocket error
Everest Liu
@evliu
Mar 24 2015 16:30
locally i don’t get the websocket error
i don’t know if there is any way to trace the iron routes
Spencer Norman
@spencern
Mar 24 2015 18:04
Did we change much in relation to shops sending email? I'm getting this exception while trying to invite a shop member.
Exception while invoking method 'inviteShopMember' ReferenceError: setMailUrlForShop is not defined
Aaron Judd
@aaronjudd
Mar 24 2015 18:47
hmm, that was ‘fixed’… but not anymore.

although I don’t see that particular error. I see:

Exception while invoking method 'inviteShopMember' TypeError: Cannot read property 'name' of undefined
I20150324-11:48:27.341(-7)?     at [object Object].Meteor.methods.inviteShopMember (packages/reactioncommerce:core/server/methods/accounts/accounts.coffee:93:48)

which looks like it’s just a problem reading shop settings

Bogi
@boboci9
Mar 24 2015 20:43
I think the publication of the accounts is causing my problems because if you are an admin the account is never created, or maybe I'm still missing something:
Meteor.publish 'accounts', (sessionId, userId) ->
  check sessionId, Match.OneOf(String, null)
  check userId, Match.OneOf(String, null)
  shopId = ReactionCore.getShopId(@)
  # admin gets it all
  if Roles.userIsInRole(this.userId, ['admin','owner'])
    return Accounts.find shopId: shopId
  # returns userId (authenticated account)
  else
    ReactionCore.Events.debug "subscribe account", sessionId, this.userId
    # get current account
    if @userId # userAccount
      accountId = ReactionCore.Collections.Accounts.findOne('userId': this.userId)?._id
    else # sessionAccount
      accountId = ReactionCore.Collections.Accounts.findOne('sessions': sessionId)?._id
    unless accountId
      accountId = ReactionCore.Collections.Accounts.insert 'sessions': [sessionId], 'userId': userId

    #return accountId
    ReactionCore.Events.info "publishing account", accountId
    return ReactionCore.Collections.Accounts.find accountId
Aaron Judd
@aaronjudd
Mar 24 2015 20:45
@spencern I’m working on the setMailURLForShop error. @boboci9 did you look at Accounts.onCreateUser?
Bogi
@boboci9
Mar 24 2015 20:47
@aaronjudd I have been trying to create a user but the Shop must be a valid alphanumeric ID error is appearing at that screen, but yes you are right the account should have been created then so the publication is just safety measures I think
I will do a meteor reset and start everything over
Aaron Judd
@aaronjudd
Mar 24 2015 20:59
this could actually be the same problem, I’m thinking some there’s a missing piece laying in a merge somewhere. I’m working through the accounts code right now.
Aaron Judd
@aaronjudd
Mar 24 2015 21:11
well - it might not have been a merge - it could have been my ax. In any case @spencern I’ve restored missing method.
Aaron Judd
@aaronjudd
Mar 24 2015 21:19
@boboci9 when you say “create a user” -> are you registering as a new “user” or, create a shop admin “user”? both are working for me now, including email
Bogi
@boboci9
Mar 24 2015 21:37
I am trying to create a user with the "Create an Account" button from the header Sign in dropdown
Spencer Norman
@spencern
Mar 24 2015 21:39

@aaronjudd I fixed that initial issue you had by updating line 99 to check for a profile before looking for name:

currentUserName = Meteor.user().profile?.name || Meteor.user().username || "Admin"

edit: also thanks for fixing.

Bogi
@boboci9
Mar 24 2015 21:40
It's very strange because I only get the error sometimes :( its difficult to debug it but I let you know as soon as I find anything
can you point me where is the Account.insert's shopId set, based on which reactioncore parameter?
Aaron Judd
@aaronjudd
Mar 24 2015 21:41
ok - I’m not seeing it. maybe session publication related (it doesn’t do any merge)
that’s probably in the Schema
@spencern I committed something similar and fixed the email send issue as well (edit: oh yeah)
Bogi
@boboci9
Mar 24 2015 21:43
I found it thanks
Bogi
@boboci9
Mar 24 2015 22:40

Not sure why this is but my error comes from here:

_.extend ReactionCore,
  shopIdAutoValue: ->
    return if @isSet and @isFromTrustedCode

    if Meteor.isClient and @isInsert
      # will be set correctly on the server
      return ReactionCore.getShopId() or "1"
    else if Meteor.isServer and (@isInsert or @isUpsert)
      # forced value for client-initiated inserts
      # or for server-initiated inserts where shopId isn't set
      return ReactionCore.getShopId()
    else
      # for client-initiated update, be
      # sure we don't allow changing this property
      @unset()
      return

I debugged it and it always enters the second else that's why I get the 'Shop must be a valid alphanumeric ID' error. Do you know what could be the issue here? It's possible that one of my packages is the problem but still not sure what I'm looking for

Aaron Judd
@aaronjudd
Mar 24 2015 22:55

@boboci9 I’m not able to reproduce this, but

ReactionCore.Schemas.Address = new SimpleSchema
  _id:
    type: String
    defaultValue: Random.id()
    optional: true
  fullName:

do you have some code that is updating the address, is it setting _id (or not)?

  addressBookAdd: (doc, accountId) ->
    @unblock()
    check doc, ReactionCore.Schemas.Address
the arguments changed for addressBookAdd
Bogi
@boboci9
Mar 24 2015 22:57
yes but the address is not added when we simply register form the Sign in dropdown is it?
The accounts schema that is giving the error is
 shopId:
    type: String
    autoValue: ReactionCore.shopIdAutoValue
    regEx: SimpleSchema.RegEx.Id
Aaron Judd
@aaronjudd
Mar 24 2015 23:12
I was looking at the first case you reported, but yes, for the account dropdown it doesn’t touch address - but it does validate the accounts schema (which is also what addressBook is using) so somewhere in the Account schema validation we're failing- are you adding anything else into the user profile? shopId, maybe? if you take a look at the users collection they should be “clean”, just meteor authentication info
Spencer Norman
@spencern
Mar 24 2015 23:38
@aaronjudd just submitted a PR for a few additional errors I found while working through the settings and adding new staff members
Aaron Judd
@aaronjudd
Mar 24 2015 23:57
@spencern thanks..merged.
lovetostrike
@lovetostrike
Mar 24 2015 23:57
is anyone working on reaction theme based on material design?
Everest Liu
@evliu
Mar 24 2015 23:58
i think that would be awesome, but a ton of work
probably use materialize package
lovetostrike
@lovetostrike
Mar 24 2015 23:58
yea, I just want to play around with it
might as well start one :D