Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Unable to upload a PDF document to File Type  #575

@gopidon

Description

@gopidon

Hi,

I have been successfully uploading PDF objects to the File Type on my GraphCool project. From today, however, I am getting the following CORS error. It was working fine till yesterday. Did something change on the server side? I am using the legacy GraphCool console project.

Error:
[Error] Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
[Error] XMLHttpRequest cannot load https://api.graph.cool/file/v1/ due to access control checks.
[Log] UPLOAD ERRRRRR: – Object (bundle.js, line 140955)
Object
[Error] Failed to load resource: Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin. (cizao5xe14rfp0166d827jbmn, line 0)

Code:
_uploadFile(e){
e.preventDefault();
var self = this;
const {id} = this.props.circular;
var fd = new FormData();
var file = document.getElementById(‘file’).files[0];
fd.append(‘data’, file)
var fileName = file.name;
$.ajax({
url: Environment.GCOOL_FILE_ENDPOINT,
data: fd,
type: ‘POST’,
// THIS MUST BE DONE FOR FILE UPLOADING
contentType: false,
processData: false,
// … Other options like success and etc
success: function(data){
console.log(“UPLOAD SUCCESS:”, data);
})

	},
	error: function(data){
		console.log("UPLOAD ERRRRRR:",data)
	}
});

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions