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

Missing host after Billing approve redirect #42

Closed
Tagra opened this issue Jan 10, 2023 · 16 comments
Closed

Missing host after Billing approve redirect #42

Tagra opened this issue Jan 10, 2023 · 16 comments
Labels
blade-engine This issue is using blade as the template engine bug Something isn't working

Comments

@Tagra
Copy link

Tagra commented Jan 10, 2023

Failure Information

default.blade.php throwing error
app-bridge@latest:1 Uncaught s {name: 'AppBridgeError', message: 'APP::ERROR::INVALID_CONFIG: host must be provided', action: undefined, type: 'APP::ERROR::INVALID_CONFIG', stack: 'AppBridgeError: APP::ERROR::INVALID_CONFIG: host must be provided'}

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. SHOPIFY_FRONTEND_ENGINE is set to BLADE
  2. Approving billing charge for new store
  3. Redirected to home route without host parameter

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.4.1
  • Laravel Version: v8.75
  • PHP Version: v8.0
  • Using a toolset Laradock
@Tagra Tagra changed the title Missing host after Billing approve reddirect Missing host after Billing approve redirect Jan 10, 2023
@gianlup
Copy link

gianlup commented Jan 10, 2023

I'm experiencing the same error

@Tagra
Copy link
Author

Tagra commented Jan 11, 2023

After approve billing there is redirect to "/authenticate/token?" without host parameter

@Tagra
Copy link
Author

Tagra commented Jan 11, 2023

@Kyon147 fix this and the beer is on me 🍺

@Kyon147
Copy link
Owner

Kyon147 commented Jan 11, 2023

Hey @Tagra

When you set up the link for the billing, is it the auto install when the app first loads?

Can you try a manual link like this <a href="{{ route('billing', ['plan' => 1, 'shop' => Auth::user()->name, 'host' => app('request')->input('host')]) }}">Upgrade</a>

Just want to rule out something.

@Tagra
Copy link
Author

Tagra commented Jan 11, 2023

App bridge is set to latest, i also tried manually to 2 but nothing changed.

App works just fine except after billing is approved, then it throws missing host error in javascript.

I think after Billing approval there is redirect to authenticate/token , and token function only sets
[ 'shopDomain' => $shopDomain->toNative(), 'target' => $cleanTarget, ]

but token layout also includes @extends('shopify-app::layouts.default') which requires host

@Kyon147
Copy link
Owner

Kyon147 commented Jan 11, 2023

Is is the app install + billing on load that is not working?

@Tagra
Copy link
Author

Tagra commented Jan 11, 2023

  1. Installing app - works fine
  2. Redirected to accept payment
  3. Accepting payment
  4. Charge is accepted
  5. Redirected to /authenticate/token?shop=xxx&target=%2F and got javascript error about missing host

Now if i go back to app it works just fine, it is installed and charge is accepted. So and the end everything works, just that last redirect throwing JS error

@Kyon147
Copy link
Owner

Kyon147 commented Jan 11, 2023

That makes sense, I might have missed the host param passing when using auto install, I'll need to take a look and release a patch as the billable middleware might not be passing host on.

@Tagra
Copy link
Author

Tagra commented Jan 11, 2023

👍

@Kyon147 Kyon147 added bug Something isn't working blade-engine This issue is using blade as the template engine unconfirmed Bug has not been reproduced yet labels Jan 11, 2023
@itrack
Copy link

itrack commented Jan 11, 2023

+1 But on all pages

{name: 'AppBridgeError', message: 'APP::ERROR::INVALID_CONFIG: host must be provided', action: undefined, type: 'APP::ERROR::INVALID_CONFIG', stack: 'AppBridgeError: APP::ERROR::INVALID_CONFIG: host must be provided'}

@itrack
Copy link

itrack commented Jan 11, 2023

I re-added shopOrigin: "{{ $shopDomain ?? Auth::user()->name }}",
Now it works ok
It was deleted here 2f65f40

@Kyon147
Copy link
Owner

Kyon147 commented Jan 11, 2023

It was removed intentionally as it will give you outdated app errors if you keep it in.

I'd recommend you remove it as it is no longer going to be supported by Shopify.

@itrack
Copy link

itrack commented Jan 11, 2023

If I delete it, the application no longer works at first install, it remains in loading, with the error in the console:

{name: 'AppBridgeError', message: 'APP::ERROR::INVALID_CONFIG: host must be provided', action: undefined, type: 'APP::ERROR::INVALID_CONFIG', stack: 'AppBridgeError: APP::ERROR::INVALID_CONFIG: host must be provided'}

This is probably not the solution, but that works now, try to delete the application completely (from shop) and start with a fresh reinstall

@Kyon147
Copy link
Owner

Kyon147 commented Jan 12, 2023

Hey both,

Try upgrading to 17.4.2 https://github.com/Kyon147/laravel-shopify/releases/tag/v17.4.2

This should be fixed in this version now, as host is being pass all the way through for the billable middleware now.

@Kyon147 Kyon147 removed the unconfirmed Bug has not been reproduced yet label Jan 12, 2023
@Tagra
Copy link
Author

Tagra commented Jan 12, 2023

Works like a charm 👍
Thanks for maintaining this repository !

@Tagra Tagra closed this as completed Jan 12, 2023
@Kyon147
Copy link
Owner

Kyon147 commented Jan 12, 2023

@Tagra glad it works for you now and thanks for the appreciation 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blade-engine This issue is using blade as the template engine bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants