Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetPlanUrl::__invoke Argument #3 ($host) must be of type string, null given #10

Closed
jasontxf opened this issue Dec 13, 2022 · 6 comments
Closed

Comments

@jasontxf
Copy link

jasontxf commented Dec 13, 2022

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

After changing plan it should redirect back successfully using billing route.

Current Behavior

When redirecting back from the billing route, I encountered this error

SCR-20221213-h4n

Failure Information

I believe this is due to the necessary $host parameter in the new updates. But when i check the url path, host parameter dont seems to exists to begin with.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Open app from the sidebar
    SCR-20221213-gxv

  2. Changing pricing plan using billing route

  3. Encounter issue.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Package Version: v17.3.3
  • Laravel Version: v9.43.0
  • PHP Version: v8.1.5

Failure Logs

Please include any relevant log snippets or files here.

Please let me know how can I further help.

@karenirenecano
Copy link

Create a query param called host and use base64_encode(Auth::user()->name) append it on the link. I had the same issue and this was my fix.

@jasontxf
Copy link
Author

@karenirenecano Thanks for replying! Which file do I append the host exactly?

@karenirenecano
Copy link

For my case it's on the pricing page. I append it on the url like this billing/1?host=the_base_encoded_shop_name

@jasontxf
Copy link
Author

ah! I see what you are saying now! I'll give it a try! Thanks alot for the suggestion!

Will update here again after trying.

@jasontxf
Copy link
Author

Hello,

Here's an updates, your suggestion works very well! Thanks alot!

I created a helper function to include host in every routes to ensure host parameter is included.

function sroute($path, $params) {
    return route($path, [...$params, 'host' => base64_encode(Auth::user()->name)]);
}

That way I dont need to change my current implementation

sroute('billing', ['plan' => 2, 'shop' => Auth::user()->name]) }}"

Though @Kyon147 are we supposed to manually include host in all our links?
Thanks alot for all your time!

@Kyon147
Copy link
Owner

Kyon147 commented Dec 14, 2022

Hi @jasontxf

If you are using the blade templates, then yes you need to include the host for every request as you can't store it in the same way that an SPA does. As your page loads multiple times it means you need to always pass it for every page load so you can load in appbridge every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants