Retrieve the initial image from s3 to load into the file pond

Trying to display the initial image from s3 in vue-file-pond, but encountering a CORS origin policy issue due to Xhr requests being blocked. (Server-side option is not used as images are submitted through the form.) Here is my file pond tag:

            <file-pond
                style="width: 100px; height: 100px"
                name="image"
                ref="image"
                label-idle="Drop files here or <span class='filepond--label-action'>Browse</span>"
                :allow-multiple="false"
                accepted-file-types="image/*"
                style-panel-layout="compact circle"
                image-preview-height="70"
                image-crop-aspect-ratio="1:1"
                image-resize-target-width="100"
                image-resize-target-height="100"
                @removefile="removefile(category.image, 'image')"
                @addfile="addImage"
                v-bind:files="image"
              />
              
              ---------------------------------
        data(){return{
                  image: this.category.image
                  ? [this.storage_url + this.category.image]
                : "",}
           }
               ,
     methods:{
     addImage() {
               this.form.image = this.$refs.image.getFile().file;
            }, 
     }

storage_url represents the S3 base URL. The image loads fine on an img tag, but in file pond... what could be done? A whole week spent dealing with this frustration!

Answer №1

After a week of confusion, I finally discovered the root cause of the issue - browser cache. When loading the s3 URL in an img tag, the browser would cache it, causing issues with XHR requests not behaving as expected. To resolve this, I made sure to prevent caching altogether. Check out this related StackOverFlow thread for more information.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to verify password against NodeJS hash Passport

I am working on creating a function that will allow users to change their password. The first step is to compare the old password with the user's current password in the database. I have written code for this inside the router function, but it doesn&a ...

A comprehensive guide on making an AJAX call to a self-hosted servlet

I created a servlet in Eclipse IDE for Java EE that posts data as an XML page and hosted it on a Tomcat server. The servlet can be accessed at http://localhost:8080/Checkers/CheckersServlet. When I open this URL in Firefox, the XML loads correctly. Now, I& ...

Error: The function of Bootstrap toggle is not defined

Currently, I am working on a Django application for warehouses and stockists. My goal is to create a list of stockists per warehouse in a button list format. When this button is clicked, a modal window should appear displaying the name, position, and permi ...

Hide a div element upon selecting an option from a dropdown menu

On iPhone 6plus and lower, I created a dropdown menu that opens when users click on "jobs" or "contact." However, after clicking on these options, the drop-down menu remains open. How can I make it hide automatically after a list item is clicked at this sp ...

How can validation of input fields be implemented in React Js?

Currently, I am dealing with a variable (in my actual application it is an API) named data, which contains nested items. Starting from the first level, it includes a title that is already displayed and then an array called sublevel, which comprises multip ...

Utilizing an Angular foreach loop for restructuring JSON data

I currently have an ng-repeat function that outputs arrays of objects in the following format: [ {"day":"10","title":"day","summary":"summary","description":"ok","_id":"53f25185bffedb83d8348b22"}, {"day":"3","title":"day","summary":"summary","description" ...

The attribute 'split' is not found on the never data type

I have a function that can update a variable called `result`. If `result` is not a string, the function will stop. However, if it is a string, I then apply the `split()` method to the `result` string. This function always runs successfully without crashin ...

Utilizing the dollar shorthand for jQuery in conjunction with Selenium

While utilizing the Selenium addon along with jQuery in my project, I encountered an issue where the use of jQuery functions containing $ in Selenium would trigger a "function not found" error. The problem was resolved by removing jQuery, but using jQuer ...

Scroll-triggered animation of SVG paths in React

While achieving this in vanilla Javascript is relatively simple (check out this for an example), I'm encountering difficulties implementing it in React, especially with a library like Framer Motion for animations. Framer Motion's useViewPortScro ...

Tips on modifying default settings for Vuetify Icons Size? (x-small, x-large, etc)

In order to streamline my project, I am looking to update the default values for icon sizes in a more efficient way. Instead of individually specifying sizes with custom classes or inline styles, I would like to be able to control all icon sizes at once du ...

Attempting to deploy my node.js application on Heroku resulted in an error message saying that the web process failed to bind to $PORT within 60 seconds of launch, causing the process to exit with status

I recently encountered an issue while attempting to deploy my node.js app on Heroku. The error message stated that the Web process failed to bind to $PORT within 60 seconds of launch, and the Process exited with status 137. I'm unsure of how to resolv ...

Is it possible to configure Webpack/NextJs to handle a recurring import path mapping?

Exploring ways to streamline imports in my NextJs Project (v14.1.3), I'm interested in finding a method to modify the import statement below: import foo from 'path/to/foo/foo' To possibly simplify it to: import foo from 'path/to/foo&ap ...

Validate that the input is an array

Looking for a way to determine if a function parameter is an array or not, and then process it accordingly. If the parameter is not an array, convert it into an array before performing the desired function. For example: interface employee { first: st ...

Issue encountered while sending a jQuery error to the server?

Utilizing jQuery ajax POST throughout my application, here's an example of an ajax post. The content type is determined by the data variable. Content Type could be either application/x-www-form-urlencoded; charset=UTF-8 or application/json; charset=ut ...

What causes CSS animations to suddenly halt?

Recently, I've been delving into the world of CSS animations and experimenting with some examples. Below is a snippet of code where two event handlers are set up for elements, both manipulating the animation property of the same element. Initially, th ...

Observing the inner workings of a vuex store

I am currently working with a store in Vue. Here is an example of MyStore.vue: export default { namespaced:true, state: { data: [], } // actions, mutations, etc } I am trying to monitor the store for new data updates. In MyOtherVueFile.vue: ...

Choose Select2 to remove all selected options

I'm looking for a way to remove all selected values in one click without having to specify each individual 'id' separately. I've tried experimenting with different approaches, but so far, I've only been able to deselect the first ...

A guide to implementing a callback function with readAsDataURL()

After reading this resource on callbacks and reviewing various examples demonstrating their use, I attempted to replicate the examples without success. Specifically, my goal is to upload a PDF document to an input field, convert the uploaded data into a b ...

No default export function available on this page

Recently delving into Nextjs, I'm currently in the process of setting up a MongoDB connection using middleware configuration. Let me showcase my code: import type { NextApiRequest, NextApiResponse } from 'next' import { connectMongoDB } fro ...

Looking for subsequence in dropdown choices with no assigned values

I need assistance with searching for a specific substring within text that is fetched from options generated by MySQL. How can I retrieve the selected option's text value in order to search for my desired substring? $(document).ready(function() { ...