Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty response from git server when using code bundler #1855

Open
Artawower opened this issue Jan 20, 2024 · 33 comments
Open

Empty response from git server when using code bundler #1855

Artawower opened this issue Jan 20, 2024 · 33 comments

Comments

@Artawower
Copy link

  • I use isomorphic-git in browser (the latest version of Chrome)
  • Installed from NPM (1.25.3)

Hello, thank you for such a great project!

When working with github repositories I get an error: EmptyServerResponseError: Empty response from git server
I can't figure out what I'm doing wrong. I was able to upload the repository I wanted once (I think without the .git at the end), but was unable to do it again. Maybe the problem is in the CORS server?

     import http from 'isomorphic-git/http/web';

     // ...

      const dir = `/test`;
      const fs = new FS('extensions');


      await clone({
        fs,
        http,
        dir,
        corsProxy: 'https://cors.isomorphic-git.org',
        url: 'https://github.com/isomorphic-git/lightning-fs',
        // url: 'https://github.com/Artawower/orgnote-atom-one-dark',
        // url: 'https://github.com/Artawower/orgnote-atom-one-dark.git',
        singleBranch: true,
        depth: 1,
      });
Network response: GET https://cors.isomorphic-git.org/github.com/isomorphic-git/lightning-fs/info/refs?service=git-upload-pack
001e# service=git-upload-pack
000001539eb71923ed02a2f23d81194feb9e99ef713f5f1b HEAD�multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/main filter object-format=sha1 agent=git/github-0ecc5b5f94fa
0047e87814f8515bf89469029e73601a6540f0235203 refs/heads/chore/refactor
006bd64b87923d2abd5078b9758a219449a8876289cb refs/heads/dependabot/npm_and_yarn/decode-uri-component-0.2.2
006f1ae0ddd2f4b4dcb2abef72e57b9626ef4b59d02e refs/heads/dependabot/npm_and_yarn/degenerator-and-karma--removed
005f67c54c9ae274f7487aa6b00f8c8ef0ad10a86ce6 refs/heads/dependabot/npm_and_yarn/elliptic-6.5.4
006aa06213d66199662d99f935a7e3b17b7dddc4b7f4 refs/heads/dependabot/npm_and_yarn/engine.io-and-karma-6.2.1
00610ec12454bbca3c8b7be0f2c5c634f27f565834a6 refs/heads/dependabot/npm_and_yarn/handlebars-4.7.7
0083f9b81165ac3ae53dbe3b95f5e0b5460809c4e84a refs/heads/dependabot/npm_and_yarn/http-cache-semantics-and-semantic-release--removed
006220868f831071478c4cb928a1d49ee5231736b053 refs/heads/dependabot/npm_and_yarn/http-proxy-1.18.1
008ddfd0c067a301ae20924c9f4a526bc40e90b8f711 refs/heads/dependabot/npm_and_yarn/json5-and-karma-webpack-and-webpack-and-webpack-cli--removed
006d6fdc5ccfd988a43bd55a9656a45b8617b41dd92f refs/heads/dependabot/npm_and_yarn/json5-and-loader-utils-1.0.2
006330a3330a393d21b5ee3f0ffef3facb4d99312cf4 refs/heads/dependabot/npm_and_yarn/loader-utils-1.4.2
0091692b436afdbb90c679281739a6b0907d178bd6f9 refs/heads/dependabot/npm_and_yarn/minimist-and-minimist-and-karma-and-mkdirp-and-extract-zip-1.2.8
0061a03186dc9be375b6254f526f22a9ce4863a4a5be refs/heads/dependabot/npm_and_yarn/node-fetch-2.6.7
0064156cf9e1800fbc167d86ff9f8cd379d667711815 refs/heads/dependabot/npm_and_yarn/normalize-url-4.5.1
005c8f54c0be61516229dfe4239a391ccdb7b8655008 refs/heads/dependabot/npm_and_yarn/npm-6.14.17
00613d52e7ed4fd095478780b1e9a6b84e72fdf5925b refs/heads/dependabot/npm_and_yarn/puppeteer-12.0.0
0059fa4ecce41c492c5d4ef838efbc9a8b326be80448 refs/heads/dependabot/npm_and_yarn/qs-6.2.4
00719d69b4c3f737385f23b4f74b6de0358eadec5163 refs/heads/dependabot/npm_and_yarn/socket.io-parser-and-karma-4.2.1
0064831ab03b00e8bee9e5f623ee515e313fefd9afa5 refs/heads/dependabot/npm_and_yarn/trim-newlines-3.0.1
00688f0a2f69011cb0df83b257ab8e8806cdd0b3b468 refs/heads/dependabot/npm_and_yarn/trim-off-newlines-1.0.3
003d13b183c70195915c981c82dfa1f1e3edebd58422 refs/heads/deps
0050bd45578cf2cd04f84cb5c70219dd5f6b61e620c7 refs/heads/feat/custom-store-names
00443dfe2dbfc545a1e8fc1f2f227d00763cd07a1463 refs/heads/feat/native
00415229f4990f4024c6a15f702447b1b8fb12220ef6 refs/heads/feat/rpc
004807554ef4954e5153a4141e1b2907938ea7acf200 refs/heads/fix-console-log
0041e905450b974cc17a4844467c86f77d278f892c38 refs/heads/fs-flush
004bd50fd84243842b961019663189a20a9a76a62ed2 refs/heads/low-level-backends
003d9eb71923ed02a2f23d81194feb9e99ef713f5f1b refs/heads/main
003f985dddb40960008bbbb052ec5616a99d62845656 refs/heads/master
00527580f6f11147b9bb8101cd5b8f293aeaa6f064af refs/heads/revert-122-fix-init-delay
003c81b81775dcc60881c6daacc6acedc1bb566215ec refs/heads/yfs
00498fd05ede6874f27f55c0c0262ad77564176cfe9f refs/notes/semantic-release
003ee6b5972b8c784bb653d9c1a765492740cc74e68f refs/pull/1/head
003f34e49c25406f776293824e1ffb61fa2f3c312142 refs/pull/10/head
004076dc7ac318ec79ea7e9c770df78e2ed6ff0306e6 refs/pull/100/head
00401ae0ddd2f4b4dcb2abef72e57b9626ef4b59d02e refs/pull/102/head
00418a2ef3203ca9b3e3005010e7194e16bc826e5f22 refs/pull/102/merge
004091a425ada849383b4de72beceb0817d2159e89a3 refs/pull/103/head
0041fc3fc411b5d563016decfb6f0bc3a1f2f087114a refs/pull/103/merge
004084f3a8b22c62c68ae6e990fae1250c807dac903f refs/pull/104/head
0041c0995671b3cde34d88ed17666c8f69a39d28020a refs/pull/104/merge
00409d69b4c3f737385f23b4f74b6de0358eadec5163 refs/pull/105/head
0041326e65fa2032e08e9cde03298f011598b66aa489 refs/pull/105/merge
0040e8f3261f67dce380fc7132a33dc3fb780c8963f2 refs/pull/106/head
004030a3330a393d21b5ee3f0ffef3facb4d99312cf4 refs/pull/107/head
004174420e1763a256536826163d3f8fb244e356b511 refs/pull/107/merge
0040a06213d66199662d99f935a7e3b17b7dddc4b7f4 refs/pull/108/head
00414ca1efdcc21621eba80d8e6ba4a813a04e2d55a8 refs/pull/108/merge
0040d64b87923d2abd5078b9758a219449a8876289cb refs/pull/109/head
0041eb2d4baca129ed54be4efd219e9c4a9bda15951f refs/pull/109/merge
003f242db3a089cded28a4c12b9e211371944183ace4 refs/pull/11/head
0040fa4ecce41c492c5d4ef838efbc9a8b326be80448 refs/pull/110/head
00410fffca6ddb6c3532c5fd36c321defc4bea0b96c0 refs/pull/110/merge
0040dfd0c067a301ae20924c9f4a526bc40e90b8f711 refs/pull/112/head
00418240324a2c6889f2c0cc975cd5cfa320ee1c5ef8 refs/pull/112/merge
00406fdc5ccfd988a43bd55a9656a45b8617b41dd92f refs/pull/113/head
0041a8dc9262c016576cfbfe7256c3f3908c7e16a33a refs/pull/113/merge
0040f9b81165ac3ae53dbe3b95f5e0b5460809c4e84a refs/pull/116/head
00419a8a01d0fa3d2b6c1d517d68e1a2d178802b49d7 refs/pull/116/merge
0040692b436afdbb90c679281739a6b0907d178bd6f9 refs/pull/118/head
0041c5d95e23360175dfd09be1cb73d684c0c7a3fd3c refs/pull/118/merge
003f72e8b21c3264d3e418812ebe03f159ef6877a0aa refs/pull/12/head
004077c3cf43cd8ea92caba4a70de9864bf9c60c8684 refs/pull/120/head
00402bab891f79674a1126076041b0a64576bd36bc35 refs/pull/121/head
0040b27d868c73a4fb96a8b497ee8d28f1ce20366520 refs/pull/122/head
00407580f6f11147b9bb8101cd5b8f293aeaa6f064af refs/pull/123/head
003f9c5ddadd5f57d0e0f9050156ed6ee55a62d31b2a refs/pull/14/head
003fc6261f1502bab75cfb3e800453280a1824b73704 refs/pull/17/head
003fdb38c5ce883c9fb2d4cf4019428f23816b551192 refs/pull/19/head
003e8c202697083327bf88fd0f4eb0712809aa5e87b6 refs/pull/2/head
003f8ce81f2be8c9e2fe8ced129ce9a058344f4032d6 refs/pull/24/head
003fa4f9dda5a78459d13335a80f157499cb2aa55c80 refs/pull/25/head
003f3dbe494b29b7c4c334054352c6f236831c9d9a4f refs/pull/26/head
003e07554ef4954e5153a4141e1b2907938ea7acf200 refs/pull/3/head
003f137e457e210e55747c1b6c894020e413805139aa refs/pull/30/head
003fbcb96d694c41abe7b7b11b38ac5789144f31d76b refs/pull/32/head
003fe543787265331b0f27c2297f2f6af597ce7ae1f2 refs/pull/33/head
003fbb2224a8e625fe518c98e7ce8f0dc79d8f180563 refs/pull/34/head
003f14ed97c06fadcc8d5fcb1e8491a504e5771bfada refs/pull/35/head
003f68d283b543519435b7b0aaa7ecbf5f2d773021bc refs/pull/36/head
003f97cb55ca5f14db097dd09d3cafdf0bc24f74ccb0 refs/pull/39/head
003ea13afed40d61b63dff187f4e9db7326ebbe20f8e refs/pull/4/head
003f154f89caa08927ec4366686dcb983851e40e2499 refs/pull/40/head
003fbd45578cf2cd04f84cb5c70219dd5f6b61e620c7 refs/pull/42/head
003f055d2999a2b1bec976e933c823b0e9be1e6de2d8 refs/pull/43/head
003f1321e9bbcce462a1e97d1f87bba32111eda0ce9d refs/pull/45/head
003fdfa970245687fa4688321ca41120cbc875661b63 refs/pull/46/head
003fb8c1426b1a719c4251ce990cf0a9c842d3db5d20 refs/pull/49/head
003e3277f531289637973dc239fa96f56693b10b1c8a refs/pull/5/head
003fbd37b460c25c4088d93cf734cb0f8e97145fc75c refs/pull/50/head
003f7d0e199767baf0fd27f69f42b0ad719766faec54 refs/pull/51/head
003f5d4de28081813c8945ad8fd932a9a9c3eae2610b refs/pull/52/head
003fe4c1679d74cd760601cbdbfac45a0ca93885d459 refs/pull/54/head
003f4b43439c869913e3cb188f20bb554451c67ee4c0 refs/pull/57/head
003f20868f831071478c4cb928a1d49ee5231736b053 refs/pull/58/head
004028b25dac4b0e622fc42ada369d582b60ed3be372 refs/pull/58/merge
003fb96c87bedc0d060f4eb621114d624adbcc331c8c refs/pull/60/head
003f1bae0bc317cce0ba573871cc36204062f761a0e3 refs/pull/62/head
003faa12e6cd5d70efc69c9ca6162173cd05ed0fe389 refs/pull/63/head
003f81b81775dcc60881c6daacc6acedc1bb566215ec refs/pull/64/head
00403e4e5a007c7e9de05defd333c71242f0d9816da8 refs/pull/64/merge
003f7663eda967424fcfae065fcdb9b26181f1c35525 refs/pull/65/head
003fb5a8a5e19732f507898257815d3b6ca1b2d66979 refs/pull/67/head
003f67c54c9ae274f7487aa6b00f8c8ef0ad10a86ce6 refs/pull/72/head
004098c564bf84dd09ebb3996876a6dac54e3d69ca13 refs/pull/72/merge
003f2bf0876f44080d7c9757d559328c917326f1e79f refs/pull/73/head
003fb63bb5f81454f43cfb32a9fea67b18e686346fd3 refs/pull/75/head
003f0ec12454bbca3c8b7be0f2c5c634f27f565834a6 refs/pull/76/head
00405ede7cee02681287d39b1d955adb46c2671b5359 refs/pull/76/merge
003fb99630d79405288d9d9b98decd99e8b28e805167 refs/pull/77/head
003f831ab03b00e8bee9e5f623ee515e313fefd9afa5 refs/pull/78/head
0040498803328436ca3c52369bf963b6b48a337bc7ec refs/pull/78/merge
003f156cf9e1800fbc167d86ff9f8cd379d667711815 refs/pull/79/head
0040ce86005604d55fffc4ca310f741616e7a4dddcaa refs/pull/79/merge
003f0675f48c450e04320b1c80970fa1bb4235be4f13 refs/pull/81/head
003f13b183c70195915c981c82dfa1f1e3edebd58422 refs/pull/82/head
003f8bbbf8c4a0828da633c9c16a9e1ce70a2992afc3 refs/pull/83/head
003f126f077f255a705c80a1fc893d06d39301b0cb8d refs/pull/84/head
003f132703d1762e30c6169b6d84aa04d4bacfd0514a refs/pull/85/head
003fa03186dc9be375b6254f526f22a9ce4863a4a5be refs/pull/87/head
004096e9cdce56ecf9c8b92106532578cc7aea64f571 refs/pull/87/merge
003f6d4d6dbfdc90569b567add9ba12d61b10acbf218 refs/pull/88/head
003fbae9df88bf4a64bdbd377d4182c0db85c67ec92c refs/pull/89/head
003ee87814f8515bf89469029e73601a6540f0235203 refs/pull/9/head
003fd7c07c1c9a031a57f945253cd4f7ea9f033640d3 refs/pull/90/head
003fd50fd84243842b961019663189a20a9a76a62ed2 refs/pull/91/head
003fe905450b974cc17a4844467c86f77d278f892c38 refs/pull/92/head
003f8f0a2f69011cb0df83b257ab8e8806cdd0b3b468 refs/pull/93/head
00403fdfdfa2e8b46e40544fe57899c272487546b128 refs/pull/93/merge
003f179e61289e36b88032f3681dbf03e59254777ef1 refs/pull/94/head
003fd4e48bf138fba0a68eb88283e07644056bb1e9d9 refs/pull/97/head
003f3d52e7ed4fd095478780b1e9a6b84e72fdf5925b refs/pull/98/head
0040b8339b88e943fd7bcb97c2750aab392a742c20ee refs/pull/98/merge
003f8f54c0be61516229dfe4239a391ccdb7b8655008 refs/pull/99/head
0040275bdbf085e03888a1ab7fc65e5522ac5efb9216 refs/pull/99/merge
003ef083b9680cc3f588c8d24a4c212064372d04de2e refs/tags/v1.0.0
003e6c67744f8f8d8b41e98c5145ff16a9d0f66c0729 refs/tags/v1.0.1
003e1ffdbd3de8e5512fc8a49ab0af9780daf0237752 refs/tags/v2.0.0
003e074547cfe2b3e36ce1adfc331b0d0181d80416cc refs/tags/v3.0.0
003e4f604fa61bf7ef27188d8be37af064141a664e87 refs/tags/v3.0.1
003ed7ab3c066c26354158a118f01e3f06221c0b103e refs/tags/v3.0.2
003e587c741901cfe2445bb32d7d35c474b68dbd99e8 refs/tags/v3.0.3
003e3c6e8031abe29a3bb6c4413f2d14ed3bf2e56ab7 refs/tags/v3.1.0
003ee47c9c17c950169dd1ae78815b3becf61e670529 refs/tags/v3.2.0
003eeef9ad41d6fea81c1de97a305c322a81b0ab7a4e refs/tags/v3.2.1
003e3ec82a724df948db0a29c59b6b44345da212f25c refs/tags/v3.3.0
003e34fac1be2b14673ae80eeee2a10c77da499c4c85 refs/tags/v3.3.1
003eb6ac6b7abc9c872ecf0523285e6243da91d801a7 refs/tags/v3.3.2
003eb6a552da93f84d7a4ed9ef850ada21aae06a577f refs/tags/v3.3.3
003e411c6d6bcb2af17cec0d623a9536bbe4bb6ee65d refs/tags/v3.3.4
003e53f154b13dfaece3c9343bc9e3894e0971e52f7d refs/tags/v3.3.5
003efb73aed9bcc9b685a627087ca38c25aa0e95ec94 refs/tags/v3.3.6
003e0524f113671aa6652d45df40d41ad2b10d4e9c51 refs/tags/v3.4.0
003ed3f78e875639b53aaaf01504b6c5ccf4f2addcc8 refs/tags/v3.4.1
003ec0490e3744607daf4dbef6c214ca56c15f22a2ab refs/tags/v3.4.2
003eac659289d1e3f9eb1e81db4f5ea821fe688b6bbd refs/tags/v4.0.0
003ed1c314cef488f1d19b9a7bcfbd330e617c0b70c9 refs/tags/v4.0.1
003eeb21a02b89c59047f5e0a846e51c10845c4fc36b refs/tags/v4.1.0
003e528382007b65579d47af986148dfe66fa356c952 refs/tags/v4.2.0
003e9bc45eb7db8fc07857ba4f59dd4e830675da6104 refs/tags/v4.2.1
003e985dddb40960008bbbb052ec5616a99d62845656 refs/tags/v4.2.2
003e40bf0bf587281aa0fc93106bc0430d1a31529874 refs/tags/v4.3.0
003e04bb61d3d7c8934120d41e78660258f9bee93237 refs/tags/v4.4.0
003eded7f73e5de54c1c157f72e801ea11b2d87da4db refs/tags/v4.4.1
003e5b69f1c8ccb296cca660df24b14a219497c7e631 refs/tags/v4.5.0
003eb86383a4c714a70ea7f06429a5f120fcae20b9fc refs/tags/v4.6.0
0000
@orangemug
Copy link

Pinning the dependency to an older version "isomorphic-git": "1.24.5" seems to fix this issue for me.

@jcubic
Copy link
Contributor

jcubic commented Jan 24, 2024

@Artawower Can you create a working reproduction that I can run?

@mojavelinux
Copy link
Contributor

I ran the following code in Node.js and it seems to work just fine:

'use strict'

const git = require('isomorphic-git')
const http = require('isomorphic-git/http/node')
const fs = require('fs')
const dir = '/tmp/repo'

;(async () => {
 fs.rmSync(dir, { recursive: true, force: true })
 await git.clone({
   fs,
   http,
   dir,
   corsProxy: 'https://cors.isomorphic-git.org',
   url: 'https://github.com/isomorphic-git/lightning-fs',
   singleBranch: true,
   depth: 1,
 })
})()

I don't really have any experience using isomorphic-git in the browser, so I can't say if that works or not.

@Artawower
Copy link
Author

@Artawower Can you create a working reproduction that I can run?

https://github.com/Artawower/isomorphic-git-problem

@jcubic
Copy link
Contributor

jcubic commented Jan 25, 2024

@Artawower I run npm install and npm run dev and got an error:

Uncaught TypeError: Buffer2 is undefined

and warning:

Module "buffer" has been externalized for browser compatibility. Cannot access "buffer.Buffer" in client code. See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

What do I need to do to run your code?

@Artawower
Copy link
Author

@Artawower I run npm install and npm run dev and got an error:

It's supposed to work, tested via 2 different machines
image

I don't think it's a code issue (there are no additional dependencies), have you tried commenting out imports from your library?

@Artawower
Copy link
Author

Try checking this repo, there is no vite there git@github.com:Artawower/isomorphic-test-2.git

@jcubic
Copy link
Contributor

jcubic commented Jan 26, 2024

Maybe add package-lock.json to the repo. You can also try to remove the lock file and install again to see if it will work.

Also what OS, Browser, NPM, and NodeJS version do you use? Maybe it matters.

Also, it looks like you use Bun for some reason. Please provide instructions on how to run your code.

@mojavelinux
Copy link
Contributor

Also what OS, Browser, NPM, and NodeJS version do you use? Maybe it matters.

FYI, these are stated in the description ;)

@mojavelinux
Copy link
Contributor

Please provide instructions on how to run your code.

Agreed. As an observer on this issue, I think the reproduction case is too complex. It needs to be simplified to isolate the problem with as little other things going on as possible. Otherwise, it could be caused by a plethora of other problems that have nothing to do with isomorphic-git.

@Artawower
Copy link
Author

Artawower commented Jan 26, 2024

  • Added.
  • OSX Sonoma 14.3, node 18.0.0
    Linux MacBook-Pro 6.6.3-411.asahi.fc39.aarch64+16k #1 SMP PREEMPT_DYNAMIC Tue Dec 19 10:21:20 UTC 2023 aarch64 GNU/Linux node v20.10.0, npm 10.3.0, any browser (I tested chrome/firefox/brave)
  • npm install && npm run dev or npm install && npm run start for the second repository

@mojavelinux
Copy link
Contributor

I couldn't get it to run either. I tried:

npm ci
npm run build
npm run preview

There are no instructions in this repository for how to actually start the application, so I was just guessing.

@mojavelinux
Copy link
Contributor

I just saw the comment about how to run it. Now I did:

rm -f package-lock.json
npm i
npm run dev

However, I get the error Jakub was getting in the browser:

Uncaught TypeError: Buffer2 is undefined

@Artawower
Copy link
Author

I just saw the comment about how to run it. Now I did:

rm -f package-lock.json
npm i
npm run dev

However, I get the error Jakub was getting in the browser:

Uncaught TypeError: Buffer2 is undefined

I already asked above, but have you tried commenting out the import from the isomorphic-git library?
Honestly it's hard for me to say anything about your error, but if you comment out the code related to the library and the project starts, then we can conclude that the problem is in the dependency. If not, it is in the environment. Unfortunately, I can't test your error.

Also, does this apply to both projects?

@mojavelinux
Copy link
Contributor

With Chrome, I get a different error:

Uncaught TypeError: Cannot read properties of undefined (reading 'from')

but have you tried commenting out the import from the isomorphic-git library?

Why in the world would we do that if the whole point is that you have having a problem with isomorphic-git?

Honestly, I think this issue needs to be closed with "insufficient test case". You're wasting the isomorphic-git maintainers' time trying to solve problems in your project. This is ridiculous.

@Artawower
Copy link
Author

You're wrong. I solved my problem in a different way, not using your library.
I was only trying to point out the problem in the open sorce project.

I gave you 2 different examples, with 2 different frameworks, only with your library as a dependency, and that's still not enough?

What's really ridiculous is that you got a bug in your own library and are trying to blame it on an insufficient example. 🥴

@mojavelinux
Copy link
Contributor

You most certainly did not provide a reproducible test case, so your assertion that there a bug in isomorphic-git is just unfounded. We went out of our way to try to run your project, which is simply not working. Jakub and I both know how to use JavaScript applications and neither of us could get it to run. Your accusations are baseless. Your insistence on criticizing the maintainers shows no good faith on your part and is clearly just and attempt to belittle us. If that's how you are going to behave, we don't want your help.

@isomorphic-git isomorphic-git locked as too heated and limited conversation to collaborators Jan 26, 2024
@jcubic
Copy link
Contributor

jcubic commented Jan 26, 2024

The second repository works and I get the error. It's weird because:

https://cors.isomorphic-git.org/github.com/artawower/orgnote-atom-one-dark/info/refs?service=git-upload-pack

return this data:

001e# service=git-upload-pack
0000015572261d0d8316cb2165ae7786f3f4fedea4bbc06a HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/github-84a1a651248e
003f72261d0d8316cb2165ae7786f3f4fedea4bbc06a refs/heads/master

So it can't be an empty response. I'm reoping the issue to figure this out.

@jcubic jcubic reopened this Jan 26, 2024
@jcubic
Copy link
Contributor

jcubic commented Jan 27, 2024

What's weird is that clone in documentation works fine. The same this CodePen. Something needs to happen with Vite.

@Artawower But since I'm not that familiar with the internals of git (I only do CR and merge PR), if you want this to get fixed you need to debug this yourself, all PRs are welcome.

@jcubic jcubic changed the title EmptyServerResponseError: Empty response from git server. EmptyServerResponseError: Empty response from git server when using Vite Jan 27, 2024
@jcubic jcubic changed the title EmptyServerResponseError: Empty response from git server when using Vite Empty response from git server when using Vite Jan 27, 2024
@isomorphic-git isomorphic-git unlocked this conversation Jan 28, 2024
@jcubic
Copy link
Contributor

jcubic commented Jan 28, 2024

So this duplication of #1680 and #1446. This needs to be added to docs, that Buffer needs to be provided when using bundler.

@orangemug, sorry didn't notice that the issue was locked when I reopened it.

I'm changing the description to add docs about Buffer dependency.

The problem is that bundlers run in NodeJS that have the Buffer but it's not included with the bundler. I'm not sure if the library can do something with detecting Buffer other than replace it with Uint8Array.

@jcubic jcubic changed the title Empty response from git server when using Vite Empty response from git server when using code bundler Jan 28, 2024
@jcubic jcubic added documentation and removed bug labels Jan 28, 2024
@shiftyp
Copy link

shiftyp commented Mar 18, 2024

Just FYI, I solved this personally by adding this to my bundled index file after installing the buffer shim from NPM:

import { Buffer } from 'buffer'

// @ts-ignore
window.Buffer = Buffer;

@shiftyp
Copy link

shiftyp commented Mar 18, 2024

While the above solved the buffer import it did not solve the empty response, as it seems like only the first line of the response is read. Debugging a bit the reader for the response itself only gives the first line before issuing done, so I'm unsure if it's a problem with Chrome or the library or a combination thereof. For chunked responses as I understand it Chrome should read the chunks of the content type isn't "text/plain" and it is correctly transmitted when cloning a repo as a service advertisement. The end result of this is an incomplete clone of the repository as it doesn't receive the full advertisement on clone. This happens for me both with my own setup and with the example in the docs

@jcubic
Copy link
Contributor

jcubic commented Mar 18, 2024

@shiftyp can you maybe create a production that we can test?

@shiftyp
Copy link

shiftyp commented Mar 18, 2024 via email

@jcubic
Copy link
Contributor

jcubic commented Mar 18, 2024

Awesome, thank you

@shiftyp
Copy link

shiftyp commented Mar 19, 2024

So I wasn't able to reproduce it simply, and some debugging revealed a combination of bugs in my code that made realizing any one of them quite difficult. A comedy of errors if you will. Anyway, thanks it looks like my original solution to the issue is serviceable for the browser

@lsegurado
Copy link
Contributor

I had the same issue some days ago. I had to import from unpkg like this
import "https://unpkg.com/isomorphic-git@1.25.8";
Instead of importing the package from node_modules

And declare it in global like this to avoid ts errors:

declare global {
   const git: typeof import("isomorphic-git");
}

Still no another workaround for this? I think its something declared globally that bundlers ignore

@jcubic
Copy link
Contributor

jcubic commented May 10, 2024

@lsegurado can you create a reproduction of the issue?

@lsegurado
Copy link
Contributor

@jcubic Yep. Here you have https://github.com/lsegurado/isomorphic-bug
Just clone it, run npm install and npm run start. You will see the exception on screen
image

@jcubic
Copy link
Contributor

jcubic commented May 10, 2024

@lsegurado So the error in your case happened because Buffer is missing. The error is misleading. The error is swallowed and a new error is thrown in a different part of the code.

This is something that can be improved to throw proper errors about a missing Buffer.

When using a bundler you need to set it up to include Buffer dependency.

@jcubic jcubic mentioned this issue May 10, 2024
16 tasks
jcubic added a commit that referenced this issue May 10, 2024
* ignore mininified files by git diff

* (chore) update async-lock dependency

* fix: fix error message when missing Buffer #1855

* fix typo
@lsegurado
Copy link
Contributor

I think this should be on the docs or re-export on a /web including the dependency.

@jcubic
Copy link
Contributor

jcubic commented May 10, 2024

Do you want to write documentation? I think there are no docs for use with bundlers.

@lsegurado
Copy link
Contributor

Sure. I will probably do it next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants