Symfony asset cache not working in production - javascript

I have been working on a Symfony application which is hosted on AWS. It seems that my image cache is not working properly. The system setup is using VichUploaderBundle, Assetic. I would like to mention I have this application working perfectly (no errors at all) locally on my MacBook.
The cache directory is in /var/www/myapp/shared/web/media/cache, this folder is 755 (same for its children), and the folder has the owners nginx:ec2-user. When an image is attempted to be loaded, eg. http://myapp.com/media/cache/resolve/login_logo/bundles/appfrontend/images/logos/linear-logo_small.png it does not load the image, nor does it create a directory in the cache to contain the image.
A similar issue is happening with the javascript for the application. Although it looks like the javascript is being loaded (the js is included on the webpages), it seems that most javascript features do not work on production only. Some examples of JS packages that are not working are Zenstruck and Swiftmailer. I am not sure if this is related to the other error we have.
There are a number of other issues also caused from javascript errors. The javascript is working perfectly on the version I have running on my MacBook.
Thanks for you help and suggestions in advance.

Related

Is there a reason as to why my locally hosted images aren't displaying on my site after uploading everything on GitHub?

o I am brand new to Github, and frankly to programming in general. I created my own portfolio website (following a Youtube guide) and have been facing so many issues trying to understand terminals and then getting it up on Github, but I must learn Github so it's worth learning it even though there are other options to post your websites onto. But after getting everything on my repositories, everything looks normal when I look at the code but when I open my website hosted on GitHub called tyler-104.GitHub.io (my portfolio website), all my images that are local to my computer won't display.
My images that aren't local are displaying ( I have one for github and one for LinkedIn) and work as they should. I thought that I simply only had to upload my local images that are also inside my HTML code to my repositories would solve it, but it does not.
If you look at my site
(tyler-104.github.io)
none of the bigger images are being displayed even after uploading my local files to my repository (https://github.com/Tyler-104/tyler-104.github.io). More than that I have tried and created multiple repositories, uploaded, altered, and updated but nothing seems to work. My only guess is that since they are local they won't display.
Do you need to somehow use images that are already stored online to make it work? Basically, would I have to remove my locally stored images (that are on my Desktop for example) in my HTML and use internet links that I want to display on some sites like Unsplash? Or can I use local images stored images and they will still be displayed?
The console of the developer mode is full of 404 for URLs like:
GET https://tyler-104.github.io/img/3D/Grapes.webp: 404
^^^^^ ?
But your repository does not have a img folder. It directly has 3D/Grapes.webp.
So might need to create img, and git mv 3D img/ in it (the commit and push), to test if those images are displayed.

Browsers load an broken version of CSS that's on the server, and not the original CSS

So I am building a website and having a problem. I have only 1 HTML file, 1 CSS file, and 1 very small javascript file. The directories are all correct, and the CSS amd javascript files are correctly linked in the HTML, but here's the problem:
When I put the files on the server and opened the website from my domain (daveyloper.com), the website is all janky. The dev tools on Chrome and Firefox show that the CSS file is different than the one I see on the server. For example, the CSS file on the server has more lines than the one in dev tools. Some styles are also altered, like my #logolink and #logoimg, as well as .project-slides p.
Another thing I noticed is that when I upload the HTML and CSS files on the server, both with filezilla and the cpanel, the size of the file changes, becomes a little bit smaller.
Also, it seems the problem is mainly related to media queries, as most things in desktop view work fine, but in mobile view which I made using media queries everything is broken.
So here are my questions:
Why is the CSS file that's loaded by the browsers altered from the one that's on the server?
Why does the CSS file load properly from my hard drive, but does the abovementioned when loaded from the server?
Is there anything I can do to fix this?
I am using infinityfree for hosting, and filezilla to load files on it, and VSCode as my IDE. I'm linking my current code below:
https://github.com/Lursmani/daveyloper.com
Any help would be appreciated. Sorry if the code there is all jank, it's my first time building a website and I started from scratch.
I found the problem. Cloudflare had a cached version of the website from yesterday and the browsers were loading that instead of the live website. I cleared Cloudflare's cache and it seems to be working fine now. Thank you for your help!

Fix for : System.Web.HttpException: The file has not been pre-compiled, and cannot be requested

We published our website and everything worked fine. After few days, something strange happened. we're getting "The file 'xxx.cshtml' has not been pre-compiled, and cannot be requested."
Resetting application pool, even restarting IIS didn’t help us to resolve the problem. Even resetting the Web server machine didn't fix the problem. but when we re-copying the published files again, web site starts working again.
We compared the problem website files with the new files, all are the same. nothing is missing. so every two-three days, we are getting the same error and the only way we can fix it is recopying the files again.
We even copied website when we got an error and then create another website based on those files and it works fine!
Any suggestion what can cause this problem?
Thanks in advance.
About the error
System.Web.HttpException: The file has not been pre-compiled, and cannot be requested
This error will come when a reference is specified in web.config and
deployment folder/site does not contain these dlls installed in the
system or bin folder does not contain them(if they are private
assemblies). For Example: (add assembly="Namespace1.NameSpace2,
Version=x.x.x.x, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/)
if your web.config contains any assemblies like this and deployed
server doesnot contain these assembiles in bin or GAC, then this error
will occur.
Scenarios:
Here are some possible scenarios that will generate this error:
When we publish the website with the "updateable" check OFF and then
copy some files on deployment location that has some markup or code in them. By
putting the "updateable" check OFF we instruct the asp.net compiler to compile all the markup and code into dll files so that further on asp.net would not consider runtime compilation of content. But if it needs to (due to the presence of such content) it will throw that error.
The second situation is when we have a web application configured in
VS.Net to run directly off IIS (the http project) and then we publish it to the same location again with the "updateable" checked OFF. There will be development files at same location which will cause similar errors.
Another situation is where we have a precompiled website and within the
root folder of it we have another folder that has content for another asp.net
application but isn¡¯t marked as application in IIS. ASP.Net tracks asp.net
applications when running on IIS by virtual directories in IIS marked as applications. A child folder having un-compiled content within a parent
application which is precompiled will again cause this error.
Source: Microsoft Support
Apparently, it is another scenario where the cause is related to missing ReportViewer .dll references
Solutions
Some people talks about adding manually the missing missing assembly files.
i found out one thing that while publishing the application it does
not copy all of the dependent assemblies in the bin folder.So i just
copied them manually to the server and now every thing is working
Other people, somehow fixed this installing "Microsoft Web Service Enhancements v3.0". Downlaod here. It probably provides missing required .dll
Here, somebody fixed it, enabling "Create a separate assembly for each page and control output" in the Deployment Options

How to serve a very simple, raw, Ember.js application?

I believe this can be considered a very silly question, but I'm really stuck on it for some time. I have a very simple Ember.js application (that means I am not using Ember-CLI) and since I am using the Facebook SDK in it, I need a valid domain.
Until now, I've ran my app simply by double clicking the index.html file in the browser.
Then, in order to have a domain for my app, I've tried using nginx inside a Docker container (so that I can add the http://<docker-ip> URL in my Facebook settings). The problem was that nginx (with the default configurations from the official Docker image) was somewhat loading a stale version of both JS files and index.html, even though the container had the latest versions of the files. I've even tried destroying the container, then starting it again and the issue persisted.
I've then tried looking at other approaches, but none satisfied my need of something simple:
node.js server, too much for serving a very basic app;
middleman, too much setup because I don't need to compile stuff (no .hbs, no less etc.);
ember-cli server, doesn't work with a normal Ember.js app;
other small JS servers, had to configure them too much for just serving some static files;
GitHub Pages and S3 do work, but...I don't want to deploy each time when developing.
So, please help me in this silly quest, how can I serve a basic Ember.js app (preferably from a Docker container)?

Javascript files won't load within Visual Studio ASP.NET 2.0 pro

I have just loaded an existing ASP.NET project into Visual Studio 2010 that is targeted at .NET 2.0. When I attempt to run it, the first page throws an error indicating that the JQuery file was not loaded ($ is undefined). If I paste the contents of the JQuery file within tags on the login page, everything works. This indicates to me that the JQuery file is not being loaded. I have verified that the path is correct.
This problem is not just with the JQuery file but with all JavaScript files, as far as I can tell.
I have copied this entire project directly from someone else's machine. It works perfectly on their machine. The project, on my computer, is at exactly the same path as on their machine.
If I go to IIS on my machine, and right-click on this application under Default Web Site, then choose Manage Application >> Browse, the application is displayed correctly in a browser. (I have verified that the virtual directory in IIS is pointing to my source code folder) So, it appears this issue is specific to the Visual Studio environment.
What could possibly be preventing the Javascript from loading. (the CSS files seem to be loading without error).
Thanks in advance for any debugging advice you can give me.
There can be many things wrong. Have you tried using Fiddler or FireBug and determined if the resources are requested? If they are what is the status that is being returned?
Is Visual Studio using IIS or the built-in Webserver?

Categories

Resources