Failed to load resource: the server responded with a status of 404 (not found salesforce)

  • Unsolved Questions
  • This Question

Failed to load resource: the server responded with a status of 404 (not found salesforce)
Venkatesh L

Failed to load resource: the server responded with a status of 404 (Not Found) while integrating react js app in lightning component

Hello Community,

I am trying to deploy React Js application in salesforce using Lightning componenets. I have found this link and followed the steps. https://developer.salesforce.com/blogs/2018/04/lightning-container-component-building-components-with-react-angular-and-other-libraries.html
This is working fine. But when I tried to upload zip file of react js application as static resource, the application is not loading. I am getting 404 error in the console. How can I resolve this? Please guide me through how to deploy react js applications in salesforce.

Thank you.

Regards,
Venkatesh

You need to sign in to do that.

Dismiss

I'm having trouble getting my browser to display the css for the app I am creating. I have looked at the same question asked by other users but have not found any of the answers to help in my situation. When I goto the page, all that is displayed is "Hello world" with no styling even though the stylesheet is linked. When I inspect the page, I get the error:

Failed to load resource: the server responded with a status of 404 (Not Found)

here's the structure of my application

. ./public /css /main.css ./routes /index.js ./views /index.html ./server.js

server.js:

const express = require('express'); const app = express(); const port = process.env.PORT || 8080; app.use(express.static(__dirname + '/public')); const router = require('./routes/index.js'); app.use('/',router); app.listen(port); console.log('connected to port: ' + port);

index.html

<!DOCTYPE html> <html> <head> <link href="../public/css/main.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> </head> <body> <p>Hello World!</p> </body>

index.js

var express = require('express'); var path = require('path'); var router = express.Router(); module.exports = router; router.get('/', function(req,res){ res.sendFile(path.join(__dirname,'../views/index.html')); });

I created a custom object on SalesForce as a System Administrator named "Log" on a Sandbox Environment with API version v45.0 . 

Able to create a recrod via Express JS through the JSForce library sucessfully and verify the write through the SalesForce portal. 

However, Microsoft Flow indicates that the resource "log" does not exist.

{ "status": 404, "message": "Salesforce failed to complete task: Message: The requested resource does not exist\r\nclientRequestId: e03fc7da-0aaa-4864-9797-42ed441244fb", "source": "Salesforce.Common", "errors": [] }

Thanks for the help in advance! 

I have Visualforce pages contains Lightning App, that contains Aura components hosted to Community aka Experience Builder, which are working fine when user is loggedIn, however, for guest users it is throwing "Failed to load resource: the server responded with a status of 401 (Unauthorized)"

for api.js and xdomain.js as shown in screenshot below.

Failed to load resource: the server responded with a status of 404 (not found salesforce)

Please find the below code for the VF page and controller class

[removed] // Here 'VfApp' Is Lightning Application Name $Lightning.use("c:UserActionMenuApp", function () { $Lightning.createComponent("c:horizontalNav", { }, "horizontalNav", function (component) { console.log("component created"); }); }); [removed]

Code for the Class file

public without sharing class CommunityUserDetailController { @AuraEnabled(cacheable=true) public static List getCurrentUser(){ System.debug('==getCurrentUser CALLED===>'); List users=new List(); if(UserInfo.getUserType()!='Guest'){ users= [SELECT Id, Name, profile.Name,SmallPhotourl,FullPhotoUrl FROM User WHERE Id =: Userinfo.getUserId()]; } System.debug('==getCurrentUser users===>'+ users); return users; } }

Any help on this will be appreciated

Thanks

The 401 Unauthorized Error is an HTTP status code error that represented the request sent by the client to the server that lacks valid authentication credentials. It may occur client does not provide the proper authentication credentials to the server within the request time.

Methods to rectify the error”failed to load resource: the server responded with a status of 401 (unauthorized)”: The 401 Unauthorized error can be fixed by using any of the following ways: Check The URL: The 401 unauthorized error may occurdue to manual typing error. Hence, checking the URL and rectifying the mistakes in it will fix the 401 error status. Flush the DNS: Errors in DNS also give rise to 401 error status sometimes. Therefore, clearing the DNS will also rectify this error. In Windows, the DNS can be flushed by typing ipconfig/flushdns in the command prompt and clicking on ENTER. Clear Uncessasry Browser Cookie:Some times, browser cookies may not work smoothly leading to improper server authentication and leads to 401 error. Thus, the error can be rectified by clearing the cookies. Logging out and Logging in again: This error may also occur during the maintenance time of the websites. Therefore, visiting the website logging out and logging in again by providing the credentials may also rectify this 401error.


How do I fix failed to load resource the server responded with a status 404?

The only way to fix this is to make sure that the CSS and JS files are properly linked within the HTML. Check whether the folder, file and directory name of these files are spelt correctly. Another way to fix this is by using an absolute URL instead of a relative URL.

What is Salesforce 404 error?

A site containing missing pages, images, JavaScript, or CSS files, can result in HTTP 404 error responses. To resolve these errors, you can use a link crawler to find broken links or missing images on any site pages. Note: We recommend that you use link crawler tools during non-peak times.