You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/01/25 07:54:00 UTC

[jira] [Work logged] (AVRO-3322) Buffer is not defined in browser environment

     [ https://issues.apache.org/jira/browse/AVRO-3322?focusedWorklogId=714258&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-714258 ]

ASF GitHub Bot logged work on AVRO-3322:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Jan/22 07:53
            Start Date: 25/Jan/22 07:53
    Worklog Time Spent: 10m 
      Work Description: ruleeeer opened a new pull request #1473:
URL: https://github.com/apache/avro/pull/1473


   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [x] My PR addresses the following [Avro Jira](https://issues.apache.org/jira/browse/AVRO/) issues and references them in the PR title. For example, "AVRO-3322:Buffer is not defined in browser environment"
     - https://issues.apache.org/jira/browse/AVRO-3322
     - In case you are adding a dependency, check if the license complies with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   
   ### Tests
   
   - [x] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   - PR simply adds declarations that do not change the actual code logic
   
   ### Commits
   
   - [x] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](https://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [x] In case of new functionality, my PR adds documentation that describes how to use it.
     - All the public functions and the classes in the PR contain Javadoc that explain what it does
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 714258)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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
>          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)