hstro
hstro
RRailway
Created by hstro on 7/22/2023 in #✋|help
Getting strange upload speeds to Railway
8c80e1be-7d5f-4dfa-b696-720ac5d60dcb
4 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Yeah I saw it quite late. Thanks a lot for putting it together
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Oooh very interesting. I would have never found that on my own - thank you very much 🙂 Is it reasonable to assume that some day the uploads will be faster without me needing to change my code? I'd love to hear why this is happening when you all find the answer 👀
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Oh man! That sucks! Very sorry to hear it. Hope it's not too much work to recover
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
I didn't have any luck during the rest of the day. I need to fix it somehow as the website is customer facing
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Hey @Brody. Do you think you'd be able to do tests today?
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Thanks, I will be around till late today. Really appreciate your help mate 🙂
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Oh right. That's cool
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
I just created an index.html file on my computer and stuck in:
<!DOCTYPE html>
<html>
<head>
<title>Simple File Upload</title>
</head>
<body>
<form
action="https://utilities.up.railway.app/upload"
method="post"
enctype="multipart/form-data"
>
<input type="file" name="file" required />
<button type="submit">Upload</button>
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Simple File Upload</title>
</head>
<body>
<form
action="https://utilities.up.railway.app/upload"
method="post"
enctype="multipart/form-data"
>
<input type="file" name="file" required />
<button type="submit">Upload</button>
</form>
</body>
</html>
results were:
uploaded file size 8.23 Megabytes
server received file in 27.18 seconds
average upload speed 0.30 Megabytes/s or 2.42 Megabits/s
uploaded file size 8.23 Megabytes
server received file in 27.18 seconds
average upload speed 0.30 Megabytes/s or 2.42 Megabits/s
so no change
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Wouldn't that mean the file would have to be sent the their back-end before being sent elsewhere?
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Not sure if it is hallucinating
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
So I asked ChatGPT :p Postman is an Electron-based application, which means it is built on top of Chromium and Node.js. While it shares some similarities with a browser, Postman is specifically designed and optimized for working with APIs, unlike web browsers that cater to a wide range of use cases and prioritize security and user experience. When making requests, Postman does not use the same APIs as web browsers, like fetch or XMLHttpRequest. Instead, it uses Node.js libraries to make HTTP requests, such as the built-in http and https modules, or third-party libraries like request (now deprecated) or axios. Since Postman is built on top of Node.js and uses server-side libraries for making requests, it is not subject to the same security restrictions and limitations as web browsers. Additionally, Postman is specifically optimized for working with APIs, which means it may have a more efficient implementation for handling file uploads compared to general-purpose web browsers. Although Postman runs in an Electron-based environment, which uses Chromium under the hood, it should not be considered equivalent to a regular web browser in terms of functionality and performance characteristics. The difference in upload speed you are experiencing between Postman and web browsers can be attributed to these differences in implementation and optimization for API-related tasks.
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Yup 😬
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
I'm quite excited to find the reason, I hope it's something good
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Haha this is so weird
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
I just updated to NextJS 13.3 for the sake of it, but not luck
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Brave, but I also tried Safari and also tried on my phone
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Not sure what API the <form> uses though
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
And the "Attempt 2" above used a simple form submit
127 replies
RRailway
Created by hstro on 4/12/2023 in #✋|help
Video upload to my ExpressJS Railway app is suuuuper slow. If locally hosting server, super fast.
Ah I also used this code:
async function submitForm(params, apiRoute, baseUrl) {
try {
// Start the timer
console.time('submitForm');

// Create a new FormData instance
const formData = new FormData();

// Iterate over the params object and append each field to the FormData
for (const key in params) {
if (params.hasOwnProperty(key)) {
formData.append(key, params[key]);
}
}

// Set up the fetch configuration object
const config = {
method: 'POST',
body: formData
};

// Send the POST request with the form data
const response = await fetch(`${baseUrl}${apiRoute}`, config);

// Check if the response is successful
if (!response.ok) {
throw new Error(`HTTP error ${response.status}: ${response.statusText}`);
}

// Handle the response as needed
const responseData = await response.json();

// Stop the timer and log the elapsed time
console.timeEnd('submitForm');

console.log(response.status, responseData);
return responseData;
} catch (error) {
// Stop the timer and log the elapsed time in case of an error
console.timeEnd('submitForm');

console.error('Error while submitting the form:', error.message);
throw error;
}
}
async function submitForm(params, apiRoute, baseUrl) {
try {
// Start the timer
console.time('submitForm');

// Create a new FormData instance
const formData = new FormData();

// Iterate over the params object and append each field to the FormData
for (const key in params) {
if (params.hasOwnProperty(key)) {
formData.append(key, params[key]);
}
}

// Set up the fetch configuration object
const config = {
method: 'POST',
body: formData
};

// Send the POST request with the form data
const response = await fetch(`${baseUrl}${apiRoute}`, config);

// Check if the response is successful
if (!response.ok) {
throw new Error(`HTTP error ${response.status}: ${response.statusText}`);
}

// Handle the response as needed
const responseData = await response.json();

// Stop the timer and log the elapsed time
console.timeEnd('submitForm');

console.log(response.status, responseData);
return responseData;
} catch (error) {
// Stop the timer and log the elapsed time in case of an error
console.timeEnd('submitForm');

console.error('Error while submitting the form:', error.message);
throw error;
}
}
127 replies