sladg / nextjs-lambda

Lambda deployments for Nextjs12 & Nextjs13 (standalone). Easy CLI commands to get your standalone Next output to run in AWS Lambda (not @Edge)! Uses CDK in behind and produces code zips importable to Terraform, Serverless, Azure, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow image lambda to fetch remote images

sladg opened this issue · comments

commented

Consider following scenario:

  • URL for images is stored in database,
  • backend is using private S3 bucket to store data,
  • when request is made, backend signs image URL,
  • frontend displays image url (ERROR 500 currently).

next.config.js allows us to specify domains allowed.

Image lambda should check if URL is absolute or relative. If relative, use internal S3 bucket, if absolute, fetch remote image.

commented

As of version v4 handler can be used to fetch and optimise any image.
Remote images as well as single S3 bucket origin are supported.