{"action":"created","issue":{"url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/issues/7","repository_url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3","labels_url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/issues/7/comments","events_url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/issues/7/events","html_url":"https://github.com/edwardspec/mediawiki-aws-s3/issues/7","id":339262244,"node_id":"MDU6SXNzdWUzMzkyNjIyNDQ=","number":7,"title":"\"doPrepareInternal: [...] unspecified location constraint is incompatible for the region specific endpoint\"","user":{"login":"edwardspec","id":1163218,"node_id":"MDQ6VXNlcjExNjMyMTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1163218?v=4","gravatar_id":"","url":"https://api.github.com/users/edwardspec","html_url":"https://github.com/edwardspec","followers_url":"https://api.github.com/users/edwardspec/followers","following_url":"https://api.github.com/users/edwardspec/following{/other_user}","gists_url":"https://api.github.com/users/edwardspec/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardspec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardspec/subscriptions","organizations_url":"https://api.github.com/users/edwardspec/orgs","repos_url":"https://api.github.com/users/edwardspec/repos","events_url":"https://api.github.com/users/edwardspec/events{/privacy}","received_events_url":"https://api.github.com/users/edwardspec/received_events","type":"User","site_admin":false},"labels":[{"id":516372891,"node_id":"MDU6TGFiZWw1MTYzNzI4OTE=","url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-07-08T22:09:25Z","updated_at":"2018-07-11T12:16:30Z","closed_at":null,"author_association":"OWNER","body":"From https://github.com/edwardspec/mediawiki-aws-s3/pull/6#issuecomment-403317693\r\n> @edwardspec - I'm picking up an occasional error in the logs now:\r\n> `AmazonS3FileBackend::doPrepareInternal : The unspecified location constraint is incompatible for the region specific endpoint this request was sent to. in /____/extensions/AWS/s3/AmazonS3FileBackend.php on line 522`\r\n> \r\n> Have checked, and LocationConstraint is usually used for the make-bucket action, shouldn't affect any GET/PUT actions. \r\n> \r\n> Any ideas?"},"comment":{"url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/issues/comments/404148162","html_url":"https://github.com/edwardspec/mediawiki-aws-s3/issues/7#issuecomment-404148162","issue_url":"https://api.github.com/repos/edwardspec/mediawiki-aws-s3/issues/7","id":404148162,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDE0ODE2Mg==","user":{"login":"gboyers","id":9747255,"node_id":"MDQ6VXNlcjk3NDcyNTU=","avatar_url":"https://avatars0.githubusercontent.com/u/9747255?v=4","gravatar_id":"","url":"https://api.github.com/users/gboyers","html_url":"https://github.com/gboyers","followers_url":"https://api.github.com/users/gboyers/followers","following_url":"https://api.github.com/users/gboyers/following{/other_user}","gists_url":"https://api.github.com/users/gboyers/gists{/gist_id}","starred_url":"https://api.github.com/users/gboyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gboyers/subscriptions","organizations_url":"https://api.github.com/users/gboyers/orgs","repos_url":"https://api.github.com/users/gboyers/repos","events_url":"https://api.github.com/users/gboyers/events{/privacy}","received_events_url":"https://api.github.com/users/gboyers/received_events","type":"User","site_admin":false},"created_at":"2018-07-11T12:16:30Z","updated_at":"2018-07-11T12:16:30Z","author_association":"CONTRIBUTOR","body":"@edwardspec I've had weird results, with some answers, and more questions. \r\n\r\nLet me cycle through every config option:\r\n\r\nNote I have two sets of identical buckets: `files-thumb` and `files-thumb.domain.com` (withdomain).\r\n\r\n1\\) `$wgAWSBucketPrefix = \"files\";` \r\nDirect to S3, standard/old bucket names (without my domain anywhere), this one works\r\n\r\nIn the debug logs I get `FileBackendStore::getFileStat: File mwstore://AmazonS3/local-thumb/File.jpg/337px-File.jpg does not exist.` - presumably this means thumbnail not found so it needs to generate one.\r\n\r\n2\\)`$wgAWSBucketPrefix = \"files\";   $wgAWSBucketDomain = \"domain.com\"; `\r\n\r\nThis throws `Fatal exception of type AmazonS3MisconfiguredException` - as it doesn't contain `$1` - presume this config style is deprecated now.\r\n\r\n\r\n3\\) `$wgAWSBucketPrefix = \"files\"; $wgAWSBucketDomain = '$1.domain.com';`\r\nThis should give: `files.domain.com` and `files-thumb.domain.com` which are the new (withdomain) bucket names.\r\n\r\nFor existing thumbnails, over HTTP, it works fine. (Over HTTPS, it tries to embed them, but because S3 shows the S3 certificate, which isn't valid for my domain.com, the browser rejects them. Would need a CDN in front of this to fix this). \r\n\r\nFor non-existing thumbnails: they just show `Error creating thumbnail: File missing`. \r\n\r\nDebug log shows:\r\n```File::transform: Doing stat for mwstore://AmazonS3/local-thumb/Logo-vector.png/93px-Logo-vector.png\r\n[FileOperation] FileBackendStore::getFileStat: File mwstore://AmazonS3/local-thumb/Logo-vector.png/93px-Logo-vector.png does not exist.\r\nTransformationalImageHandler::doTransform: creating 93x77 thumbnail at /home/user/tmpdir/transform_b98818bdd676.png using scaler im\r\nTransformationalImageHandler::doTransform: called wfMkdirParents(/home/user/tmpdir)\r\n[thumbnail] Thumbnail failed on ip-172-___: could not get local copy of \"Logo-vector.png\"\r\n```\r\n\r\nThis has made me wonder if the thumbnail error is because the extension is trying to fetch  over SSL. If so, it would be presented with the S3 certificate which isn't valid for domain.com, so could reject it.\r\n\r\nThere's nothing in the http or HttpError logs, but I tried changing line 149 of `AmazonS3Hooks.php` to be `return 'http://' . $domain;` to see if that worked - but it doesn't.\r\n\r\nNote, the internal URL to the S3 bucket would be: `files-thumb.domain.com.s3.amazonaws.com` - this isn't specified anywhere, so not sure if you use it. This would be different for cariaso who uses short bucket names behind his CDN. Do we need to specify the publicurl/internalurl separately? \r\n\r\n4\\) `$wgAWSBucketDomain = 'files$2.domain.com';` (no prefix set)\r\nThis should set the same URLs as number 3 above (`files-thumb.domain.com`)\r\n\r\nHowever, in this one, all thumbnails show `Error creating thumbnail: File missing` with the same debug errors.\r\n\r\n5\\) `$wgAWSBucketDomain = [  'public' => 'files.domain.com', ...etc`\r\n\r\nThis should set the same URLs as number 3 above (`files-thumb.domain.com`) but all thumbnails show `Error creating thumbnail: File missing` with the same debug logs as number 3.\r\n\r\n6\\) `$wgAWSBucketDomain = [  'public' => 'files.domain.com.s3.amazonaws.com'` ...etc`\r\n\r\nThis should set the direct-to-s3 url, without any CDN. But all thumbnails show `Error creating thumbnail: File missing` with the same debug logs as number 3.\r\n\r\n7\\) `$wgAWSBucketDomain = [ 'public' => 'files.s3.amazonaws.com', etc`\r\nThis is the original config from number 1 - using the old buckets with no domain in. \r\n\r\nBut this doesn't work.  All thumbnails show `Error creating thumbnail: File missing` with the same debug logs as number 3.\r\n\r\n---\r\n\r\nIn my debug logs, I also had some permissions errors on the images folder, which I'd removed after moving to S3:\r\n```mkdir(): Permission denied\r\nFSFileBackend::doPrepareInternal: cannot create directory /home/user/www/images/thumb/File.svg```\r\n\r\nI've sorted out the permissions, but this isn't one of the directories you mentioned above. It's not using any of my tmpdirs. Does this mean it's going to try to create a permanent local copy of every thumbnail? Doesn't that defeat the point of S3? Should it delete the thumb after it's been uploaded to S3? Or should I be purging this folder regularly?\r\n\r\nI also got another `AmazonS3FileBackend::doPrepareInternal : The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.` error when cycling through the above configuration options but I didn't see which one for.\r\n\r\nNot sure if any of that is helpful - I think I need to have a proper HTTP CDN in front of the images."}}
{"actor":{"display_login":"gboyers"}}