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
Comments
Pinning the dependency to an older version |
@Artawower Can you create a working reproduction that I can run? |
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 I run
and warning:
What do I need to do to run your code? |
It's supposed to work, tested via 2 different machines I don't think it's a code issue (there are no additional dependencies), have you tried commenting out imports from your library? |
Try checking this repo, there is no vite there git@github.com:Artawower/isomorphic-test-2.git |
Maybe add 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. |
FYI, these are stated in the description ;) |
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. |
|
I couldn't get it to run either. I tried:
There are no instructions in this repository for how to actually start the application, so I was just guessing. |
I just saw the comment about how to run it. Now I did:
However, I get the error Jakub was getting in the browser:
|
I already asked above, but have you tried commenting out the import from the Also, does this apply to both projects? |
With Chrome, I get a different error:
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. |
You're wrong. I solved my problem in a different way, not using your library. 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. 🥴 |
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. |
The second repository works and I get the error. It's weird because: return this data:
So it can't be an empty response. I'm reoping the issue to figure this out. |
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. |
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. |
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; |
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 |
@shiftyp can you maybe create a production that we can test? |
Absolutely, I'll try to get on up in a codesandbox today
…On Mon, Mar 18, 2024, 3:39 PM Jakub T. Jankiewicz ***@***.***> wrote:
@shiftyp <https://github.com/shiftyp> can you maybe create a production
that we can test?
—
Reply to this email directly, view it on GitHub
<#1855 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABAGWBK7A5RKVSKIX65FBDYY47FJAVCNFSM6AAAAABCDJK6MGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBUG43TENZRGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Awesome, thank you |
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 |
I had the same issue some days ago. I had to import from unpkg like this And declare it in global like this to avoid ts errors:
Still no another workaround for this? I think its something declared globally that bundlers ignore |
@lsegurado can you create a reproduction of the issue? |
@jcubic Yep. Here you have https://github.com/lsegurado/isomorphic-bug |
@lsegurado So the error in your case happened because 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 |
* ignore mininified files by git diff * (chore) update async-lock dependency * fix: fix error message when missing Buffer #1855 * fix typo
I think this should be on the docs or re-export on a /web including the dependency. |
Do you want to write documentation? I think there are no docs for use with bundlers. |
Sure. I will probably do it next week. |
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?
Network response:
GET https://cors.isomorphic-git.org/github.com/isomorphic-git/lightning-fs/info/refs?service=git-upload-packThe text was updated successfully, but these errors were encountered: