GET http://localhost:8100/null 404 (Not Found)


#1

I’m testing my App in my browser, and fetching from Facebook a profile picture, and I’m getting this error in the console. All works fine btw! Can anyone advice why such as error is coming up?

GET http://localhost:8100/null 404 (Not Found)


#2

Seems like something is executing before it actually has a value in the variable. How do you load the image in your code?


#3

Yes, true! I’m just directly loading then like so. Is there a better way?

<img [src]="i.photo1" class="slidePhoto">


#4

How and when is i set? I think @Sujan12 is onto something.


#5

I’m getting it from Firebase Database, but this is a URL to a Facebook profile photo, which is stored on Facebook servers. All photos stored on Firebase Storage come out without this error.

  <div *ngFor="let i of object">
 <img [src]="i.profilePhoto"></div>


  firebase.database().ref('/bd/' + this.id).once('value', (snapshot) => {
          let temp = {
            profilePhoto: snapshot.val().profilePhoto
          }

          this.object.push(temp);

#6

Hmm, then that can’t be it, because the template won’t try to access i before it exists if it’s coming out of an ngFor. Can you put a breakpoint on Http's get() method and see what is calling it with a null url?


#7

I’m not using Http’s get() method. I’m just putting the image url into the img tag and that’s all. Also the strange thing is, with all the other photos (from Firebase storage) there are no issues, only with the profile photo from Facebook. Any ideas how to debug this?


#8

How do you know this is from the Facebook profile photo?


#9

I’ve tested it, and this error goes away when I comment out the img tag with Facebook profile photo URL in it.


#10

You should check whether any Facebook profile photo is null or not, use *ngIf for each image within the iteration.


#11

I have similar problem, when I launch the app with serve it call the http://localhost:8100/____/wp-json/wp/v2 and get a 404 not found; if I open browser and call http://localhost/_____/wp-json/wp/v2 I get the response…
I need to remove the :8100 from the call, but I don’t know how… :persevere: Or I am wrong?


#12

Same problem. and I solved it by using *ngIf.
like below.
<img *ngIf=“photo” [src]=“photo”>

I hope this helps you.