{"action":"created","issue":{"url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/245","repository_url":"https://api.github.com/repos/googleapis/nodejs-storage","labels_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/245/labels{/name}","comments_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/245/comments","events_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/245/events","html_url":"https://github.com/googleapis/nodejs-storage/issues/245","id":334279885,"node_id":"MDU6SXNzdWUzMzQyNzk4ODU=","number":245,"title":"Calling signed URL generated from Cloud Function by web app gives Access-Control-Allow-Origin header errors on preflight OPTIONS call","user":{"login":"nathanclemente","id":1984966,"node_id":"MDQ6VXNlcjE5ODQ5NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/1984966?v=4","gravatar_id":"","url":"https://api.github.com/users/nathanclemente","html_url":"https://github.com/nathanclemente","followers_url":"https://api.github.com/users/nathanclemente/followers","following_url":"https://api.github.com/users/nathanclemente/following{/other_user}","gists_url":"https://api.github.com/users/nathanclemente/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanclemente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanclemente/subscriptions","organizations_url":"https://api.github.com/users/nathanclemente/orgs","repos_url":"https://api.github.com/users/nathanclemente/repos","events_url":"https://api.github.com/users/nathanclemente/events{/privacy}","received_events_url":"https://api.github.com/users/nathanclemente/received_events","type":"User","site_admin":false},"labels":[{"id":699305272,"node_id":"MDU6TGFiZWw2OTkzMDUyNzI=","url":"https://api.github.com/repos/googleapis/nodejs-storage/labels/type:%20question","name":"type: question","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-20T23:06:05Z","updated_at":"2018-06-25T14:49:00Z","closed_at":null,"author_association":"NONE","body":"#### Environment details\r\n\r\n  - OS: macOS High Sierra 10.13.4\r\n  - Node.js version: 8.9.4\r\n  - npm version: 6.0.1\r\n  - `@google-cloud/storage` version: ^1.7.0\r\n\r\n#### Steps to reproduce\r\n\r\nI have a cloud function that gets a write signed URL for a Storage object. It follows the tutorial here: https://cloud.google.com/functions/docs/writing/http#file_uploads_using_cloud_storage\r\n\r\n```\r\n// Get a reference to the destination file in GCS\r\n    const file = storage.bucket(bucketName).file(req.body.filename);\r\n\r\n    // Create a temporary upload URL\r\n    const expiresAtMs = Date.now() + 300000; // Link expires in 5 minutes\r\n    const config = {\r\n      action: 'write',\r\n      expires: expiresAtMs,\r\n      contentType: req.body.contentType,\r\n    };\r\n\r\n    file.getSignedUrl(config, function (err, url) {\r\n      if (err) {\r\n        console.error(err);\r\n        res.status(500).end();\r\n        return;\r\n      }\r\n      res.send({\"signedUrl\": url});\r\n    });\r\n```\r\n It returns the URL back to the app client and the client calls the PUT method on the URL with the file. However, we are getting the following from Chrome:\r\n\r\n**Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.**\r\n\r\nThere are no CORS responses headers coming back from the signed URL - is there something I need to configure during URL generation to get my origin to pass?\r\n\r\nLet me know if you need more info. Thank you!!"},"comment":{"url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/comments/399978833","html_url":"https://github.com/googleapis/nodejs-storage/issues/245#issuecomment-399978833","issue_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/245","id":399978833,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTk3ODgzMw==","user":{"login":"nathanclemente","id":1984966,"node_id":"MDQ6VXNlcjE5ODQ5NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/1984966?v=4","gravatar_id":"","url":"https://api.github.com/users/nathanclemente","html_url":"https://github.com/nathanclemente","followers_url":"https://api.github.com/users/nathanclemente/followers","following_url":"https://api.github.com/users/nathanclemente/following{/other_user}","gists_url":"https://api.github.com/users/nathanclemente/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanclemente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanclemente/subscriptions","organizations_url":"https://api.github.com/users/nathanclemente/orgs","repos_url":"https://api.github.com/users/nathanclemente/repos","events_url":"https://api.github.com/users/nathanclemente/events{/privacy}","received_events_url":"https://api.github.com/users/nathanclemente/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T14:49:00Z","updated_at":"2018-06-25T14:49:00Z","author_association":"NONE","body":"Any thoughts on this @JustinBeckwith (or know anyone who can look at it for us)? We're hoping to use this flow but may have to switch to the storage JSON API instead if we can't get past this. Thanks!"}}
{"actor":{"display_login":"nathanclemente"}}