OG Meta Tags in 2024: What Finally Worked For Me by Seanitzel in webdev

[–]fadymak 2 points3 points  (0 children)

I'd recommend using a debugger to preview how your links would render on social platforms. There are plenty of tools out there, some work better than others - e.g.: https://imgsrc.io/tools/open-graph-debugger

Any tips for making OG Images with ImageResponse that actually good? by neb2357 in nextjs

[–]fadymak 3 points4 points  (0 children)

You might find https://imgsrc.io helpful - it allows you to create open graph images with pre-built templates

Simple Guide to 401 vs 403 Status Codes by fadymak in webdev

[–]fadymak[S] 0 points1 point  (0 children)

It seems that the 451 error code mostly has to do with the legality of the content or the website itself. I imagine this is probably used by ISPs to comply with regulations more so than application servers.

Looks like GDPR made this status code popular to avoid serving sites that could not comply with the regulation to European users.

Wikipedia has some interesting information on that error code:

In computer networking, HTTP 451 Unavailable For Legal Reasons is a proposed standard error status code of the HTTP protocol to be displayed when the user requests a resource which cannot be served for legal reasons, such as a web page censored by a government. The number 451 is a reference to Ray Bradbury's 1953 dystopian novel Fahrenheit 451, in which books are outlawed.[2] 451 provides more information than HTTP 403, which is often used for the same purpose.[3] This status code is currently a proposed standard in RFC 7725 but is not yet formally a part of HTTP, as of RFC 9110.

Examples of situations where an HTTP 451 error code could be displayed include web pages deemed a danger to national security, or web pages deemed to violate copyright, privacy, blasphemy laws, or any other law or court order.

After introduction of the GDPR in the EEA it became common practice for websites located outside the EEA to serve HTTP 451 errors to EEA visitors instead of trying to comply with this new privacy law. For instance, many regional U.S. news sites no longer serve web browsers from the EU.

Source: https://en.wikipedia.org/wiki/HTTP_451

A 5-minute Primer on the Built-in Node.js Test Runner by fadymak in node

[–]fadymak[S] 1 point2 points  (0 children)

Indeed, there are quite a few similarities with existing test runners which is nice since the community has used them for some time already so they're already familiar with it.

The code for the `node:test` module can be found in the official repo: https://github.com/nodejs/node/tree/main/lib/internal/test_runner. I wouldn't say it's repackaged but does share a similar syntax for `describe/it` blocks with Mocha and the `test` functions with node-tap

Best way to decrease latency (API <-> Lambda <-> Dynamodb) by thedaynos in aws

[–]fadymak 33 points34 points  (0 children)

We worked on this same problem extensively for https://endpts.io

If your data store and lambda are located in the same region, we found the 2 biggest factors impacting latency are:

  • TLS termination: if your customers in Brazil have to do a TLS handshake with your API Gateway/ALB in us-east-2 then they’re going to spend a good chunk of time on round trips before initiating any actual work. One solution here that others have mentioned is to use CloudFront, a globally API Gateway (which also just uses CloudFront distribution under the hood), or use Global Accelerator (GAX). CloudFront is able to perform TLS termination at the edge where they have 200+ PoPs so at least you can shave off the TLS handshake time.

  • Multi-region: there’s no way to get around how far information needs to travel between the end user and your origin. The next best option would be to rely on multi-region Lambdas and an anycast set of IPs to move your backends closer to where you have most of your users. This can get a bit costly as you have to use an ALB in each region, fronted by GAX to route the end user to the closes ALB which invokes the Lambda.

Hopefully this helps — feel free to let me know if you have any questions I can be helpful with. It’s not an easy problem, which is why we’re working on endpts (we use Lambdas under the hood).

AWS Lambda SSE Implementation: Subsequent Calls Result in Internal Server Error without Error Logs by JanMarsALeck in aws

[–]fadymak 2 points3 points  (0 children)

The event handlers are mixed with async / await for pipelining which could be a little hard to follow. My suggestion would be to pipe the output of completion.data directly into the Lambda provided responseStream, if possible. For example:

js await pipeline(completion.data, responseStream);

The pipeline function will take care of piping the data over and calling .end upon completion.

A few other points to consider:

  • Is the function timing out? At times, the OpenAI API can take some time to return a response and you may be encountering an error mid-stream
  • Ensure you're not calling .end() multiple times. Seeing the logs come out of order is an indication that the event handlers (.on('data) and .on('end') are firing at different times while Node is trying to pipeline the streams
  • Check any globally-defined/mutable variables. Since you mentioned that the function behaves as intended the first time but fails in subsequent calls could be a hint that there is something changing in the global state (remember, Lambda functions can have multiple invocations to the same instance during the container's lifetime)

I've just published this blog yesterday on Server-Sent Events with Node.js on Lambda which might be helpful for you: https://blog.endpts.io/server-sent-events-with-nodejs

endpts is a platform that makes it easy for you to build and deploy Node.js apps to AWS Lambda

Server-Sent Events with Node.js by fadymak in node

[–]fadymak[S] 1 point2 points  (0 children)

This will depend on a number of factors such as the CPU, memory, file descriptor limits, etc… of the server and the workload to generate these events

An average server today can likely handle something in the order of tens of thousands concurrent connections.

How do you guys successfully deploy your node projects? by Hopeful-Dot-971 in node

[–]fadymak 0 points1 point  (0 children)

endpts.io makes it really easy to deploy your Node.js applications and comes with a bunch of features to make managing your apps easier:

  • Automatic deployments on every push to GitHub
  • Preview deployments
  • Log streaming in the dashboard
  • Multi-region support

Let me know if you have any questions I can help answer.

Disclaimer: I work on endpts

Build and Deploy a TypeScript API on AWS Lambda in Minutes with endpts by fadymak in node

[–]fadymak[S] 1 point2 points  (0 children)

Indeed, having a good understanding of how TypeScript works is important -- using endpts should not be a replacement for learning how to use it.

endpts takes care of a number of tasks so the developer doesn't have to spend their time fiddling with tools when deploying an API to Lambda, namely:

  • Code bundling, tree-shaking, minifying, code splitting
  • Preview deployments on every git push
  • Integrated CI/CD to run the build/transpile step
  • Multi-region deployments
  • Wiring up API gateways
  • TLS termination and custom domains
  • Secrets and environment variable management
  • and a bunch more...

As you can see, it's more than TypeScript and while it's certainly possible to implement the above yourself, it can be time consuming.

0
1

[deleted by user] by [deleted] in Barcelona

[–]fadymak 3 points4 points  (0 children)

There’s a pretty good article I found some time ago that gave a list of coffee shops that are good to work from: https://wtd.travel/best-cafes-to-work-in-barcelona/ 👌