Firebase Storage Access to fetch at '..' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource - firebase-storage

For debugging purposes, I'm using the 'CORS Unblock' extension on chrome and I'm able to load without any CORS issues.

To resolve this
Go to https://console.cloud.google.com and select the dashboard of the project that contains the firebase storage bucket.
On the top right, there will be a button named "Activate Cloud Shell", click on it, a terminal will open on the bottom of the page, and near the middle of the page there will be a button called "Open editor", click on it. From there you should see this:
Click on File, on the menu on top. New file. Call it cors.json, paste the following (from Firebase's documentation) and hit save.
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
Go to https://console.firebase.google.com/ and select "Storage" from the menu on the left, get your storage bucket url (it starts with gs://)
Then open the terminal again (Activate Shell Command) and paste
gsutil cors set cors.json gs://<your-cloud-storage-bucket>
In theory the error should be completely gone for that specified bucket.
Note, this would only apply to the storage bucket you entered, you can have CORS policies per project, as you can have multiple buckets per project. It's intuitive and flexible.

Related

Using Lucee Server with Command Box problems accessing Server Administration page

I recently downloaded CommandBox to try to set up a Lucee Server. I have a folder called LuceeSever with an Index.cfm page. When I type the command "box server start" it opens a window at this address: http://127.0.0.1:54613 displaying my index.cfm page. Cool.
But I would like to connect a datasource and I would like to do this thorough the server admin panel that everyone else says to use. So when I try to access http://127.0.0.1:54613/lucee/admin/server.cfm I get this screen:
So I created a password.txt file that contains 1 line of plaintext that is the password I wanted to use. So my directory looks like this:
LuceeServer>
index.cfm
password.txt
In which index.cfm and password.txt are at the same level. When I click import file the screen reloads and nothing happens.
I assume I have things set up incorrectly. I've never used commandbox before and I dont really know what I'm doing.
You can bypass this entirely by using CFConfig. You can either specify the adminPassword in your .cfconfig.json file
{
"adminPassword":"myPass"
}
or you can install commandbox-dotenv and set a global .env file that has a cfconfig_adminPassword key.
~/.box.env
# Add environment variables to be loaded into CommandBox when it starts
# Variables are in the form of foo=bar, one per line
cfconfig_adminPassword=myPass
Disclaimer: I am the lead developer of CommandBox and the CFConfig module.
When you run your server with CommandBox, click on its tray icon in the right corner of your desktop, click open and then the server home folder like shown on the image below:
Then navigate to /WEB-INF/lucee-server/context/ and place your password.txt file there. Then go back to lucees server admin page in your browser and click the "import file" button to import the password.txt file.
Your password.txt needs to go in the "root Lucee server directory", which isn't the same as your site's web root (which wouldn't be a very secure place to put it). In CommandBox the location is a bit obscure, but you can find it with the following command:
server info property=serverHomeDirectory

Heroku Review Apps not deploying at all

I'm trying to automatically create review apps as part of my pipeline and testing procedure when pull requests are created on the corresponding GitHub repository. When the PR is created, it appears as a review app, but doesn't actually get created.
In the DevTools console, a 404 error is there about the review-app-config. I'm not sure if this is directly related, as I've successfully created a review app on a different pipeline (with a different owner) with the same error.
This 404 error changes between the file not being available at all, or that it's returning an error. When it's the latter, the file contains the following:
{"id":"missing_version","error":"Please specify a version along with Heroku's API MIME type. For example, `Accept: application/vnd.heroku+json; version=3`.\n"}
I'm creating and managing all of the apps/pipelines with the GUI on dashboard.heroku.com. The version accept header appears to be needed for the Heroku API but I've no idea how to implement it. Any help would be greatly appreciated!
Firstly check that your app.json file is valid json. If it isn't then that will cause the deployment to fall over.
Secondly check if you have any scripts in the app.json key. If you have any here and they are incorrect then this will also cause it to hand and fall over with no warning displayed.
{
"name": "App name",
"scripts": {
"deploy": "command that won't work!!"
},
...
}
You many not need any scripts in here so it can also be empty!
{
"name": "App name",
"scripts": {},
...
}

How to load local files from user selected directory in chrome app

I am developing chrome app , in my app user can download external content to their local directory , to access user's file system i am using chrome.FileSystem API ,i can access user's local directory and i am also able to write downloaded content to their directory by keeping user selected directory to localStorage.
My problem is i want to open these files in main html file using either webview / iframe , it will be better if its possible with iframe but i am getting error in both cases -
to get full path i am using below code -
chrome.fileSystem.getDisplayPath(chosenEntry, function(path) {
console.log("path"+path);
// for now i am adding static path to it for testing purpose
var finalPath = path+'/folder/index.html'; //Here finalPath is a valid path , can be accessible from browser
});
if i load it using iFrame -
Refused to frame 'path' because it violates the following Content Security Policy directive: "frame-src 'self' blob: filesystem: data: chrome-extension-resource:".
When i tried using webview -
: The load has aborted with error -301: ERR_DISALLOWED_URL_SCHEME.
I have also tried by giving permission in manifest.json file -
"permissions": [
"file:///*"
]
Note : user may have number of downloaded content each with their own folder , so i have to open any of these according to user action.
It's not the most elegant solution, but running a web server inside chrome your chrome app and pointing the webview at the web server URL will work.

Firebase Deployment Directory Structure

I'm receiving a 'not found' error on my successful sign-in url. Auth works great and I pass the target where I'd like to navigate using the sample FirebaseUI App:
'signInSuccessUrl': 'https://fezziwig.firebaseio.com/games/game1/index.html'
I've got a folder structure like this:
Root/public/games/game1/index.html
All my files are being deployed but I'm curious about the folder structure. Once it's sent up to Firebase is there any way to see the hosted contents in their control panel?
I tried keeping the firebase.json file in my root folder very simple:
{
"hosting": {
"public": "public"
}
}
I have created the games folders after running Firebase init. Is that part of the problem?
Anyway, long story short, I can login but get 'not found' when I try to navigate to a landing page.
Thanks for your time.
My mistake. I was trying to navigate to a path within the database and not an actual page.

dropbox - get an {"error": "Invalid origin"} when i try to upload a file

I was try to upload a file using the Drop box Saver as following:
"https://www.dropbox.com/developers/dropins/saver"
I see the Drop box saver button and when I'm clicking on it I get an error: {"error": "Invalid origin"} in a popup...
I also added to the "Drop-ins domains the local host ip,127.0.0.1
In the popup window that open when clicking on the button there is the uri:
https://www.dropbox.com/saver?origin=file%3A%2F%2F&app_key=undefined&version=2
Maybe the problem is that after the word "file" there are the following characters %3A%2F%2F and there is no file name or location...
app_key is undefine although i added it
What can i do?
It looks like you're opening your HTML directly from the file system instead of running a web server. I believe you'll need to actually run a web server (could be as simple as python -m SimpleHTTPServer) so the URL in the address bar starts with http (or https) and has a domain.