File not found

WMD
New Member
13 0 0

He guys,

i am facing another issue while developing a public app.

I am using javascript with ajax post and get requests to my server.

I am using an ajax request to one of my php files to check status of my app into a database.

6 out of 10 times, i get file not found on that specific file, or missing icon, missing pictures or other files that 4 out of 10 work fine.

I am using Shopify's proxy

I haven't had this issue before but recently my app works 4 out of 10 browser refreshes.

 

Replies 8 (8)

Alex
Shopify Staff
1561 81 341

Hey @WMD.

 

I'm hoping I can get some clarification to better help you out:

 

From where exactly are you making the ajax request? The view rendered through the app proxy?

 

Is the PHP file the backend of the same app?

 

Does doing this outside of an app proxy context work just fine 10 out of 10 times?

 

Can you show front end code I could use to replicate on perhaps a non-PHP app?

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

WMD
New Member
13 0 0

Hi Alex,

I will answer question by question below.

The ajax requests are made to a php file found on my app's folder using shopify's proxy

Yes, the php file is a part of the same app.

I am not sure what do you mean. The request it is a simple request for the state of a value into my db, using plain javascript.

 

My Javascript function is as below

 

function getAjax(url, success) {
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
xhr.open('GET', url);
xhr.onreadystatechange = function() {
	if (xhr.readyState>3 && xhr.status==200) success(xhr.responseText);
};
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.send();
return xhr;
}

 

 

getAjax('http://' + hostname + '/apps/myapp/checkapp.php?p1=1&p2=2', function(data){ 
console.log(data); 
});

 

Please note that the hostname a variable containing store's url.

Every time I got the error, I checked the link for that file and it is accessible 100% every time.

 

Please let me know if I missed anything.

Thank you 

WMD
New Member
13 0 0

Right.

I have done some more tests now and it looks like the Proxy does not points towards the files that are coming back as not found.

After a few refreshes, the file is found and works as intended.

It is not just PHP files, it's images and icons too.

 

Alex
Shopify Staff
1561 81 341

Thanks for the extra info.

 

Can you clarify for me what you mean by the Proxy does not points towards the files that are coming back as not found? Where is the proxy pointing to instead if it isn't pointing to your files? Also, would you mind sharing your app's numeric ID? You can find that on the end of the URL in your partners dashboard when viewing it directly.

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

WMD
New Member
13 0 0
Hi,

At the moment im away from my work pc but I can tell you that when I am getting the error, I copy the link to that file or image which is something like:

https://shopname.myshopify.com/apps/myappname/assets/image.png

Am I asking for the images using the wrong URL? Should I go straight to https://myappname.com/assets/image.png or should I use Shopify's proxy?

The browser returns page not found.
After a few refreshes or a few minutes later the picture can be accessed and the app works fine.

WMD
New Member
13 0 0

Hi again Alex,

Here's the number you requested 2809547

Please let me know if I am doing something wrong.

Thanks

Alex
Shopify Staff
1561 81 341

How consistently are you able to replicate this? On my end, I have not been able to replicate. Is your server receiving these requests if you can see in your logs? This seems like a strange one for sure. Form what I can tell, you're not doing anything specifically incorrectly.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

WMD
New Member
13 0 0
I managed to narrow down the issue and it looks like its a server issue.
I will raise this issue with the technical support