netlify-stripe-subscriptions
netlify-stripe-subscriptions copied to clipboard
Manage Subscription links to /[Object, object] when I spin this up on my own Netlify site.
Bug report
Describe the bug
After spinning this up on my own Netlify site, the "Manage Subscription" link is broken and I can't figure out why... Clicking it takes me to /[object%20Object]
To Reproduce
I followed the steps from this blog post... https://www.netlify.com/blog/2020/07/13/manage-subscriptions-and-protect-content-with-stripe/
- Go to https://steady-cocada-5186f1.netlify.app/
- Click on "Manage Subscription"
- See error at https://steady-cocada-5186f1.netlify.app**/[object%20Object]**
Expected behavior
I expected it to redirect to the stripe subscription management page like it does in your live demo.
Screenshots
This is what I get when I try on my site after clicking "Manage Subscription"...
System information
- OS: Windows 10
- Chrome
- Server environment: Node
Additional context
Sorry for creating an issue about this since your live demo is working correctly but I can't figure out why it work when I try to do it all myself.
Here is my repo...
https://github.com/cmarabate/netlify-stripe-subscriptions
But the only thing that I changed from the original repo is the Fauna graphql endpoint, I changed it to the US endpoint...
When I spin it up locally and click the Manage Subscription my terminal tells me...
Request from ::1: POST /.netlify/functions/create-manage-link
{"level":"error","message":"End - Error:"}
{"errorMessage":"Cannot read properties of undefined (reading 'getUserByNetlifyID')","errorType":"TypeError","level":"error","stackTrace":["Object.exports.handler (C:\\Users\\Owner\\_Dev\\_Sites\\_RaidChamps\\netlify-stripe-subscriptions\\functions\\create-manage-link.js:20:36)","processTicksAndRejections (node:internal/process/task_queues:96:5)"]}
Response with status 500 in 857 ms.
hmm, that's a good question. It's possible that something in the Stripe library changed, maybe? @charliegerard-stripe does this look like anything you've seen before by chance?
Has anyone else tried settings this up on a new Netlify site recently to confirm that it is not just me having this issue?
This has just happened to me, I haven't given fixing it a go yet but will share if I have any luck
I think the issue is to do with your customer portal settings in Stripe. Visiting https://dashboard.stripe.com/settings/billing/portal and "activating" your customer portal link worked for me. I think if it isn't activated, the manage subscriptions button points to <Your Netifly Site>/(jsonified error message) rather than the stripe customer portal.
Thanks @dfaram7 I thought that might be it because I went clicked your linked and saw that I had not activated my Customer portal link, so I activated it and then redeployed my site but it did not resolve the issue sadly.
Actually it does work!!! I did the same thing in Test mode and it worked!
Spoke too soon, it only seems to work when I login with the same email address as my stripe account. If I try logging in from a different email address I get that same /[object%20Object] issue...
Hey! 👋 Sorry I missed this, let me look into it and get back to you!
Cool thanks @charliegerard-stripe! After my previous message I tried switching my API keys back and forth between the ones from "Test mode" and the live ones but it didn't seem to make any difference. It lets me signup and login with other email addresses but when logged-in the "Free Content" image does not change like it does when I login with the email address of my stripe account and like I mentioned in my previous comment... Clicking manage subscription takes them to /[object%20Object]
Also after signing up from a different email address, I do not see them get added to my Customers in my Stripe dashboard.
I am willing to give you full access to my repo and stripe account if that helps. just let me know.
@charliegerard-stripe I just figured out what is causing the issue!!!
I was trying to signup using the "Continue with Google" option. But when I do that it creates the user in Netlify but it does not properly set the free role. It works if I signup the long way and enter my Name, Email, and Password. Same exactly issue if I use the "Continue with Github" button.
So apparently it just does not work with External providers. Feel free to close this issue.
Awesome, thanks @cmarabate!