-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Bug]: Getting different output in local CLI and Deno Deploy #648
Comments
hi @ip2location it looks like the issues is the file read command - if you look at this endpoint https://kewp-refer-location.deno.dev/test you can see bytes read is only
|
interestingly - if you refresh https://kewp-refer-location.deno.dev/test you'll see the number of bytes read changes! |
@ip2location i've fixed it. if you read the file all in one go then you can read the bytes in correctly. see https://kewp-refer-location.deno.dev/test2 the updated code is in https://github.com/kewp/refer-location |
This seems to be an issue with Deno Deploy. Transferring it to the Deploy issue tracker. |
This is either a lack of documentation in Node (and you need to fix your code to call The reason you are seeing different behaviour in the Deno CLI and Deno Deploy is that the FS have different speeds locally and on Deploy, so different number of bytes can be read with a single syscall. |
Ok, I have received a response on the Node issue. It looks like this is not a Deno bug, but instead stems from how the Linux When you call The Deno docs for the file system read method document this behaviour: https://deno.land/[email protected]?s=Deno.FsFile&p=prototype.read. The reason you did not encounter this locally, is that the chance for these "partial reads" depends on the specific file system you are using. On Deploy they are more likely than locally. |
Thanks @lucacasonato that makes a lot of sense. Didn't catch that comment on the Deno docs |
We will close the ticket now as we found a workaround to the issue. However it's still strange that the nodeJs FS module can behave differently in local and Deno Deploy. |
Version: Deno 1.42.1
We have developed a Deno module for our IP2Location BIN database. One of our users complained that he was unable to query the data from our IP2Location BIN database using our module. After a closer examination and debugging of the the code, we found out that the
node:fs.readSync
is not working correctly and causing our module to return wrong data. Below is the simplest code to reproduce the outputs:The expected output is as below(Running in local):
![denodeploy2](https://private-user-images.githubusercontent.com/6367210/319810529-7261032a-7cdd-46c0-8d95-74bec6352f3a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTk4MTksIm5iZiI6MTczODk5OTUxOSwicGF0aCI6Ii82MzY3MjEwLzMxOTgxMDUyOS03MjYxMDMyYS03Y2RkLTQ2YzAtOGQ5NS03NGJlYzYzNTJmM2EucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMDcyNTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDQ0Y2FmOWU0Zjk1NzkzMWJhMzNlMTc1NjIyNTA3NDNiYTc0N2M0MGU0MWE0YjI0NjlhZjhlZTVmODY0NGU5ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.VVmf3Gahv4xcXe7XBq7iiYc_roHi2kmQeVgfJxB8dYA)
However, in Deno Deploy, I got a different output like this(Sequence from bottom to top):
![denodeploy3](https://private-user-images.githubusercontent.com/6367210/319810614-39ccfb33-04d1-436f-909f-2dacee7c24fd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTk4MTksIm5iZiI6MTczODk5OTUxOSwicGF0aCI6Ii82MzY3MjEwLzMxOTgxMDYxNC0zOWNjZmIzMy0wNGQxLTQzNmYtOTA5Zi0yZGFjZWU3YzI0ZmQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMDcyNTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZGM0ZWNmMTYwZjdlYjNmNTVlZjhhNTIwODRhNjliZDdlZjJjMWQ2NjY1NzA2YjEzOTA2MDAwY2Q1NmM1ZmNlMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.9O98knde4tKV3O7TCvlJDq-4_bV5vNwBgZCQnqEu1hk)
The IP2Location LITE DB3 BIN database used in the code can be obtained by signing up from here: https://lite.ip2location.com/database/db3-ip-country-region-city.
Can we get someone to take a look at this? Thanks.
The text was updated successfully, but these errors were encountered: