/auth/login 404 with shopify app proxy

CarlosC24
Shopify Partner
8 0 2

I followed a YT video on how to set up an app proxy. I also looked at a lot of Shopify forum posts to no avail
I get this error in the dev tools console (I think the Youtuber deleted my comment when I tried asking about this error)
GET https://testingwishlist.myshopify.com/auth/login 404 (Not Found)

and this from my terminal
GET /app/proxy/?shop=testingwishlist.myshopify.com&logged_in_customer_id=&path_prefix=%2Fapps%2Fproxytest&timestamp=1718050314&signature=819a839
ceb80bf73ef9b978ad39c7ddcf7324744ea00b4d06710ffefb5cbff4f 302

Here is my proxy.liquid and my proxy.js

<body>
    <button onclick="testProxy()">test proxy</button>
</body>

<script async src={{ "proxy.js" | asset_url }} defer></script>

{% schema %}
{
  "name": "Proxy Embed",
  "target": "section",
  "settings": [
    {
      "type": "header",
      "content": "Proxy button to customer wish list"
    }
  ]
}
{% endschema %}

 

function testProxy() {
    return new Promise((resolve, reject) => {
        fetch("https://testingwishlist.myshopify.com/apps/proxytest"), {
            method: 'POST',
            redirect: 'manual',
            headers: {
                'Content-Type': 'application/json',
                'Access-Control-Allow-Origin': '*',
            }
        }
    }).then((response) => {
        console.log(response, 'response');
    }).then((data) => {
        resolve(data)
    }).catch((error) => {
        reject(error)
    })
}

Here is my app.proxy.jsx which is in the routes folder

import { authenticate } from '../shopify.server'
import { Page } from '@shopify/polaris'
import { cors } from 'remix-utils'
import { json } from '@remix-run/node';

export const loader = async ({request}) => {
    console.log('---hit app proxy----')

    const {session} = await authenticate.public.appProxy(request)
    
    return await cors(request, json({status: 200}))
}

const Proxy = () => {
    return <Page>proxy </Page>
}

export default Proxy

The console.log in my app.proxy.jsx does turn up in the terminal along with the error, so I at least know that its connected to the fetch in proxy.js

My App proxy settings in Shopify Partner is : 
Subpath prefix: apps
Subpath: proxytest
Proxy URL: https://journalists-attribute-slim-paste.trycloudflare.com/app/proxy 
The URL changes each time I restart the app from the terminal, so I always make sure to update the Proxy URL

The App Proxy Url from the admin settings is: https://testingwishlist.myshopify.com/apps/proxytest

I did add this to my remix.config.js file but it didn't change anything 

serverDependenciesToBundle: [
    /^remix-utils.*/,
  ],



 

Replies 5 (5)

taniokas
Shopify Partner
5 0 0

I'm getting this error too! is this Di Stephano's tutorial hahah? Do you have hosting setup on yours, I'm thinking it might have to do with how my app is built up to fly.io. But I'm not sure. I'm getting a 404 error on my proxy GET, same as you

CarlosC24
Shopify Partner
8 0 2

I don't have a dedicated hosting setup, just been using application_url from the .toml file for my proxy url

taniokas
Shopify Partner
5 0 0

Maybe try adding this under the [webhooks] section in the shopify.app.toml ?

[app_proxy]
url = "yourcloudflarelink.com"
subpath = "yoursubpath"
prefix = "apps"

 

This from someone in the discord server where they actually have their proxy url only set with the main directory. Unlike the video where he does the full proxy app url.

taniokas_0-1718440797825.png

 

here's the discord discussion. https://discord.com/channels/597504637167468564/1251292194631843952

I'll be trying out and debugging more tomorrow

CarlosC24
Shopify Partner
8 0 2

I just looked and my shopify.app.toml file already has that section in there. I think it auto updates whenever I restart the server.

taniokas
Shopify Partner
5 0 0

gotcha, gotcha. Yeah so the discord steps didn't fix anything? I can try messaging the guy on discord to see if he has an example