[ 
https://issues.apache.org/jira/browse/AVRO-3322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated AVRO-3322:
---------------------------------
    Labels: pull-request-available  (was: )

> Buffer is not defined in browser environment
> --------------------------------------------
>
>                 Key: AVRO-3322
>                 URL: https://issues.apache.org/jira/browse/AVRO-3322
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: js
>         Environment: Firefox 96 & Brave 1.34(based on chromium)
>            Reporter: ruleeeer
>            Priority: Blocker
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When I use avro in my browser, I find that I get the `Buffer is undefined 
> error`
> Later I traced the source code and found that Buffer is used directly in 
> `/etc/browser/avro.js` and `/lib/schema.js`, which is not a problem in the 
> node environment because the Buffer object is mounted globally, but it is a 
> problem in the browser environment because using buffer polyfill will not 
> mount the Buffer object globally, You need to  declare `var Buffer = 
> require('buffer').Buffer` manually, so that it can be used in the browser 
> environment without affecting the node environment, which also gets its 
> Buffer from require('buffer').
> I will submit a PR to fix this issue



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to