# User cannot use custom avatar with Amazon S3

**URL:** https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583
**Category:** Bug
**Created:** [February 23, 2015, 9:22pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583 "2015-02-23T21:22:33Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 23, 2015, 9:22pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/1 "2015-02-23T21:22:33Z")

</div>

We upgraded the discourse to 1.3.0.beta1  
After that, users cannot change their avatars. Moreover, if user has already used his own avatar and try to change the custom avatar, his avatar changes to default Gavatar.  
We use Amazon S3 to hold the uploaded files.

Anyone experienced this problem?

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 23, 2015, 9:52pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/2 "2015-02-23T21:52:42Z")

</div>

It seems that the “save” button did not call any js script.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 23, 2015, 11:31pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/3 "2015-02-23T23:31:05Z")

</div>

Do you have any failures in `/logs`?

Also note that **using S3 for uploaded files is deprecated and slated to be removed sometime in the future**.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 24, 2015, 12:39am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/4 "2015-02-24T00:39:50Z")

</div>

It’s slated to be removed in 1.3 actually, not “sometime in the future”

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 24, 2015, 1:41am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/5 "2015-02-24T01:41:39Z")

</div>

> [@riking](#):
>
> Do you have any failures in /logs?

There is no errors in /logs, which is bizarre.

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 24, 2015, 1:42am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/6 "2015-02-24T01:42:47Z")

</div>

> [@codinghorror](#):
>
> It’s slated to be removed in 1.3 actually, not “sometime in the future”

which means both uploaded files and backup files should be stored on the server that runs discourse?

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 24, 2015, 1:54am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/7 "2015-02-24T01:54:39Z")

</div>

> [@franklyn](#):
>
> There is no errors in /logs, which is bizarre.

I found the error in /logs. It should be:

**info**  
Uncaught SecurityError: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported.  
Url: [https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js](https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js)  
Line: 11  
Column: 69  
Window Location: [https://discourse.noflynodrivezone.org/users/franklyn/preferences](https://discourse.noflynodrivezone.org/users/franklyn/preferences)

**backtrace**  
Error: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported.  
at Error (native)  
at HTMLImageElement.n.onload ([https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js:11:30353](https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js:11:30353))

**env**  
HTTP\_HOST: [discourse.noflynodrivezone.org](http://discourse.noflynodrivezone.org)  
REQUEST\_URI: /logs/report\_js\_error  
REQUEST\_METHOD: POST  
HTTP\_USER\_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36  
HTTP\_ACCEPT: _/_  
HTTP\_REFERER: [https://discourse.noflynodrivezone.org/users/franklyn/preferences](https://discourse.noflynodrivezone.org/users/franklyn/preferences)  
HTTP\_X\_FORWARDED\_FOR: 100.34.14.173  
HTTP\_X\_REAL\_IP: 100.34.14.173

params:  
message: Uncaught SecurityError: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may no  
url: [https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js](https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js)  
line: 11  
column: 69  
window\_location: [https://discourse.noflynodrivezone.org/users/franklyn/preferences](https://discourse.noflynodrivezone.org/users/franklyn/preferences)  
stacktrace: Error: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 24, 2015, 3:07am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/8 "2015-02-24T03:07:06Z")

</div>

Your Chrome version is out of date, you’re on 39 and stable is 40. Try rebooting.

I think you have a canvas tainting bug in your version of Chrome, which is making client-side resizing of the image impossible.

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 24, 2015, 3:21am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/9 "2015-02-24T03:21:38Z")

</div>

> [@riking](#):
>
> Your Chrome version is out of date, you’re on 39 and stable is 40. Try rebooting.

upgraded to Chrome 40 but got the same error 😢

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 24, 2015, 3:23am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/10 "2015-02-24T03:23:04Z")

</div>

Use FireFox gives a slightly different error:

HTTP\_HOST: [discourse.noflynodrivezone.org](http://discourse.noflynodrivezone.org)  
REQUEST\_URI: /logs/report\_js\_error  
REQUEST\_METHOD: POST  
HTTP\_USER\_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0  
HTTP\_ACCEPT: _/_  
HTTP\_REFERER: [https://discourse.noflynodrivezone.org/users/franklyn/preferences](https://discourse.noflynodrivezone.org/users/franklyn/preferences)  
HTTP\_X\_FORWARDED\_FOR: 100.34.14.173  
HTTP\_X\_REAL\_IP: 100.34.14.173

params:  
message: SecurityError: The operation is insecure.  
Url: [https://discourse.noflynodrivezone.org/assets/applicat](https://discourse.noflynodrivezone.org/assets/applicat)  
url: [https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js](https://discourse.noflynodrivezone.org/assets/application-6ca7abb9990beb8627b7b95957c8c7c4.js)  
line: 11  
column: 0  
window\_location: [https://discourse.noflynodrivezone.org/users/franklyn/preferences](https://discourse.noflynodrivezone.org/users/franklyn/preferences)  
stacktrace: Discourse.Utilities.cropAvatar/\</n.onload@[https://discourse.noflynodrivezone.org/assets/application-6](https://discourse.noflynodrivezone.org/assets/application-6)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 24, 2015, 3:33am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/11 "2015-02-24T03:33:49Z")

</div>

Where is the avatar you’re uploading coming from? If you’re dropping in an image from another browser window, that’s your problem. Save it to your filesystem first.

Note: It works on My Machine™

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 24, 2015, 11:26am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/12 "2015-02-24T11:26:13Z")

</div>

It is not from other browser window.  
It is from my local filesystem.  
I also disabled the S3 for storage and this does not work either.

---

<div class="post-metadata">

### Author: ![NomNuggetNom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nomnuggetnom/32/122685_2.png) [@NomNuggetNom](https://meta.discourse.org/u/NomNuggetNom)
#### Post date: [February 24, 2015, 2:14pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/13 "2015-02-24T14:14:00Z")

</div>

Getting the same error from multiple users on our instance. Doesn’t seem to matter what format the image is.

---

<div class="post-metadata">

### Author: ![czhou1801](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@czhou1801](https://meta.discourse.org/u/czhou1801)
#### Post date: [February 24, 2015, 5:39pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/14 "2015-02-24T17:39:33Z")

</div>

I working together with @franklyn

we tried to disable this option, ‘automatically download gravatars’. but it seems that when users try to upload their own avater, they always get Gravator (the 2nd optioin in the window, ‘change your profile picture’.

---

<div class="post-metadata">

### Author: ![NomNuggetNom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nomnuggetnom/32/122685_2.png) [@NomNuggetNom](https://meta.discourse.org/u/NomNuggetNom)
#### Post date: [February 25, 2015, 9:16pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/15 "2015-02-25T21:16:21Z")

</div>

Here’s another error log. Still quite a big problem for us.

Info

```plaintext
Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
Url: http://forum.minecraftpvp.com/assets/application-92226ececbc49206d08980e7920bc4e2.js
Line: 11
Column: 69
Window Location: http://forum.minecraftpvp.com/users/dj_burgerz/preferences

```

Backtrace

```plaintext
Error: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
    at Error (native)
    at HTMLImageElement.n.onload (http://forum.minecraftpvp.com/assets/application-92226ececbc49206d08980e7920bc4e2.js:11:30353)

```

---

<div class="post-metadata">

### Author: ![jimc](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jimc](https://meta.discourse.org/u/jimc)
#### Post date: [February 26, 2015, 1:58pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/16 "2015-02-26T13:58:15Z")

</div>

Have the same issues and errors in my discourse instance. Just updated to 1.3.0beta1.

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 27, 2015, 2:09am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/17 "2015-02-27T02:09:56Z")

</div>

follow the discuss at  
[https://meta.discourse.org/t/avatar-upload-not-working/20075/26](https://meta.discourse.org/t/avatar-upload-not-working/20075/26)  
to upgrade to v1.3.0.beta1 +102, still have the problem but no error logs at all.

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [February 27, 2015, 5:03am UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/18 "2015-02-27T05:03:37Z")

</div>

> <https://github.com/discourse/discourse/blob/main/app/controllers/users_controller.rb#L480-L482>

the model didn’t saved here.

---

<div class="post-metadata">

### Author: ![franklyn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franklyn/32/39199_2.png) [@franklyn](https://meta.discourse.org/u/franklyn)
#### Post date: [February 27, 2015, 12:02pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/19 "2015-02-27T12:02:32Z")

</div>

> [@fantasticfears](#):
>
> the model didn’t saved here.

Sorry, but do not understand what you mean, you find how to fix it? or should I do something to fix it?

---

<div class="post-metadata">

### Author: ![NomNuggetNom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nomnuggetnom/32/122685_2.png) [@NomNuggetNom](https://meta.discourse.org/u/NomNuggetNom)
#### Post date: [February 27, 2015, 9:40pm UTC](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583/20 "2015-02-27T21:40:03Z")

</div>

Now getting this error after clearing some storage and upgrading the docker manager (doubt either are related).

```plaintext
SecurityError: The operation is insecure.
Url: http://forum.minecraftpvp.com/assets/application-92226ececbc49206d08980e7920bc4e2.js
Line: 11
Column: 0
Window Location: http://forum.minecraftpvp.com/users/kazwolfe/preferences

```

Backtrace

```plaintext
Discourse.Utilities.cropAvatar/</n.onload@http://forum.minecraftpvp.com/assets/application-92226ececbc49206d08980e7920bc4e2.js:11:30350

```

Started after updating to 1.3.0 beta 1.

[Next page](https://meta.discourse.org/t/user-cannot-use-custom-avatar-with-amazon-s3/25583.md?page=2)
