question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

customerRecover, customerReset and invalid type ID!

See original GitHub issue

I’m currently implementing a password reset flow, and ran into an issue with the customerReset mutation. Firing customerRecover sends an email notification, as expected. I modified the email notification template to point to my server instead, for example http://localhost:3000/reset-password/6655363669/7c4a5966d0901b57ee96af96eddb0eb5-1503254727.

The problem is that customerReset takes a customer ID, which should be 6655363669 here. But from what I can tell, that’s a Shopify Customer ID, but not necessarily a Shopify Storefront API Customer ID? The exact error I get is “GraphQL error: Variable id of type ID! was provided invalid value”. The docs show an ID that looks like Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=, and not 6655363669. Do I need to modify the email notification template? If so, what Liquid template variable(s) do I use to create a correct password reset URL?

An example that includes password recovery would be great, but it also just looks like that mutation is expecting the wrong arguments.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
nickdandakiscommented, Aug 21, 2017

So, I looked for a Liquid variable for just the reset password token and couldn’t find one. customer.reset_password_url is used in the ‘Customer account password reset’ email notification template, however that’s undocumented as well.

I ended up with this hack:

{% assign reset_password_url = customer.reset_password_url | replace: "https://token-local.myshopify.com/account/reset", "http://localhost:3000/reset-password" %}

Which is also fine for right now, but obviously don’t want to rely on this either. Here’s a Shopify forum post I found that’s related to this.

What I’d like to have is access to Liquid variables for the Customer Storefront API ID, and the Customer Reset Password Token.

I’m assuming the customerActivate mutation will run into the same issue too. So might be best to also have a Liquid variable for the Customer Activation Token!

2reactions
swalkinshawcommented, Aug 21, 2017

The quick workaround is to build the encoded ID yourself:

gid://shopify/Customer/6655363669 is the format. Then you Base64 encode it.

Warning: do not rely on this long term. These IDs are encoded for a reason because they can change. This is just a quick fix for this.

We’ll have to figure out a proper solution to this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

customerRecover mutation - Shopify Developers
The reset password email contains a reset password URL and token that you can pass to the customerResetByUrl or customerReset mutation to reset...
Read more >
Jackson JsonMappingException: Invalid type id - Stack Overflow
The main problem is when I try to deserialize this object and I don't have this dudClass instance on classpath I will receive...
Read more >
Shopify.Unity Namespace Reference
Wraps around a shipping address and shipping identifier. ... Return type for customerRecover mutation. ... Return type for customerReset mutation.
Read more >
Shopify Storefront-Api-Examples Issues - IssueHint
customerRecover, customerReset and invalid type ID! closed, 23, 2017-08-21, 2022-11-28. Support for Relay Modern, open, 12, 2017-07-12, 2022-12-02 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found