How can I make a non-embedded app using CLI 3 in Shopify?

How can I make a non-embedded app using CLI 3 in Shopify?

JhonLevy
Shopify Partner
4 0 2

Hi There,
Im pretty new to Shopify Public app development and i started a new test app from Shopify Node.js template.
I used this the instructions from Here.

Im using CLI 3 and to Create the app i used this command:
"npm init @Shopify/app@latest"

I follow all the steps and finally i have a running QR generator App.

JhonLevy_4-1672584186753.png

 


Now i want to make the app non-embedded, i follow those steps but the app still opens in Shopify Admin:
1. Disable "Embedded" app - directly from Shopify App Setup --> Embedded App Manage --> Disable "Ebedded"

JhonLevy_0-1672583824452.png

JhonLevy_1-1672583865014.png

 

2. I've Set forceRedirect: from "true" to "false" on the AppBridgeProvider.jsx file.

JhonLevy_3-1672583918426.png

 

I know there is the 3rd step on the server file to set "IS_EMBEDDED_APP" to "false" but in CLI 3 that is missing.

The app still redirect to embedded app and i cannot escape this iframe.


I would like to receive suggestions on ways to solve this problem, because I did not find any correct and available information about it.

Thanks ! 

 

Replies 7 (7)

RobinKaith
Shopify Partner
27 2 2

Hi @JhonLevy ,
Happy New Year.

For your 3rd step, follow this path in CLI 3 template:
web->shopify.js

See attached screenshot:

bdde83b9-2891-4eb6-b228-372d4c52afa5.jpg

But this can't resolve your concern. This will throw a session token issue. As I also want to make an non-embedded app. 

Please let us know if anyone is familiar with CLI 3 and how to convert Embedded to Non-Embedded.

Thanks.

4cardbot
Shopify Partner
3 0 1

Hi @JhonLevy , @RobinKaith ,

 

I hope you are doing great.

 

I am stuck at the same issue. Were any of you able to find a solution for this?

4cardbot
Shopify Partner
3 0 1

Hi @JhonLevy , @RobinKaith ,

 

I hope you are doing great.

 

I am stuck at the same issue. Were any of you able to find a solution for this?

Divy_tatva
Shopify Partner
32 1 13

Hello @JhonLevy , @RobinKaith 

 

Is anyone of you able to find a solution? 

 

i am stuck at the same issue.

4cardbot
Shopify Partner
3 0 1

@Divy_tatva  @JhonLevy  @RobinKaith 

To solve the issue, 3 steps need to be taken:
1. Disable "Embedded" app - directly from Shopify App Setup --> Embedded App Manage --> Disable "Ebedded"

 

2. set "forceRedirect: false" in shopify.js file as shown below.

Screenshot 2023-05-31 at 4.18.43 AM.png

 

3. In index.js file, remove the line:
app.use(serveStatic(STATIC_PATH, { index: false }));

 

and add the code below instead:

app.use("/*", 

shopify.validateAuthenticatedSession(),

async (_req, res, _next) => {return res.redirect(301, final_url);}

);

Also, you can delete the 'frontend' directory from the repo since you'll not be displaying anything on the frontend.

vipingarg
Shopify Partner
2 0 0

Hi @4cardbot ,

I followed same steps, but this doesn't work. It redirects me to iframe and throw error.

The application cannot be loaded, it may be misconfigured. Please contact the application author.
danieldyrnes
Shopify Partner
1 0 0

@vipingargit worked for me after I made sure the 'final_url' is my destination domain, eg: dashboard.myapp.com.

Not sure if it helps, but you never know 🙂