OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

React images load locally but not on AWS Amplify

  • Thread starter Thread starter brennan mcgowan
  • Start date Start date
B

brennan mcgowan

Guest
Hi I am working with an API that retrieves the URL of an image. I am then trying to pass that URL into an tag as follows:

Code:
<img class="img-fluid" src={this.state.representatives[i].pic}/>

Locally I am met with

Local server

But when I try to use the app on AWS Amplify, I am met with:

enter image description here

I have tried hardcoding the URL into the app but it returns the same error. I am really confused where to go from here.

For example the image URL pulled from the API for Mark Warner is http://bioguide.congress.gov/bioguide/photo/W/W000805.jpg

and I know I am not messing with this URL as it loads locally. Am I making a simple error somewhere?

<p>Hi I am working with an API that retrieves the URL of an image. I am then trying to pass that URL into an
tag as follows:</p>
<pre><code><img class="img-fluid" src={this.state.representatives.pic}/>
</code></pre>
<p>Locally I am met with</p>
<p><a href="https://i.sstatic.net/1KSWT.png" rel="noreferrer"><img src="https://i.sstatic.net/1KSWT.png" alt="Local server" /></a></p>
<p>But when I try to use the app on AWS Amplify, I am met with:</p>
<p><a href="https://i.sstatic.net/urW0r.png" rel="noreferrer"><img src="https://i.sstatic.net/urW0r.png" alt="enter image description here" /></a></p>
<p>I have tried hardcoding the URL into the app but it returns the same error. I am really confused where to go from here.</p>
<p>For example the image URL pulled from the API for Mark Warner is <a href="http://bioguide.congress.gov/bioguide/photo/W/W000805.jpg" rel="noreferrer">http://bioguide.congress.gov/bioguide/photo/W/W000805.jpg</a></p>
<p>and I know I am not messing with this URL as it loads locally. Am I making a simple error somewhere?</p>
 

Latest posts

Top