Next Api Og Image Versions Save

:bowtie: Easy way to generate open-graph images dynamically in HTML or React using Next.js API Routes. Suitable for serverless environment.

4.3.0

1 year ago

What's Changed

Explanation

This release is kinda continuation of https://github.com/neg4n/next-api-og-image/releases/tag/4.2.2, in other words - next-api-og-image development heading towards start being able to be hosted on VPS or dedicated servers or any other non-serverless environment. This time we introduce option to set custom chrome parameters directly in next-api-og-image options object!

New properties

// NOTE: Options within 'chrome' object only works when next-api-og-image is run in server (not serverless!!) environment.
chrome: {
  // Custom command-line args passed to the browser start command
  // by default, no arguments are provided.
  args: null
  // Custom executable provided. Useful when you e.g. have to run Chromium instead of Google Chrome
  // by default, executable is retrieved automatically (it looks for Google Chrome in the filesystem)
  executable: null,
}

Acknowledgements

Thanks to @vanniewelt and @njoguamos for contributing to the project ❤️

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/4.2.2...4.3.0

4.2.2

1 year ago

What's Changed

Explanation

The next-api-og-image library was intended to be used only in cloud environments at the beginning. That is why it was not designed with mind of support for hosting on VPS / Dedicated servers. Recently, the #40 issue came up to the open and this was a opportunity to add support both server and serverless environments

From now on, the next-api-og-image should work out of the box both on server (with chrome installed) and serverless environments. This also means that testing the application using next-api-og-image locally with NODE_ENV set to production will no longer throw an error regarding chrome 🚀

Acknowledgements

Thanks to @guhyeon, @mvandergrift and @kamenskiyyyy for contributing to the issue development 🤗

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/4.2.1...4.2.2

4.2.1

1 year ago

From now on issues related to invalid chrome executable path (while on local development environment) should not happen 😄

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/4.2.0...4.2.1

4.2.0

1 year ago

Added return value to hook function passed in configuration object. From now on, this function can return Map containing custom headers that will be set before sending response with open-graph image to client.

Example code:

import { withOGImage } from 'next-api-og-image'

export default withOGImage({
  template: {
    react: ({ myQueryParam }) => <div>🔥 {myQueryParam}</div>,
  },
  hook: () => {
    const headers = new Map()
    headers.set('X-My-Header', 'cool-thing')
    return headers
  },
})

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/4.1.0...4.2.0

4.1.0

1 year ago

4.0.1

2 years ago

BREAKING CHANGE: From now on, next-api-og-image has chrome-aws-lambda in peerDependencies... but what does it mean?

When installing next-api-og-image >= 4.0.0 you also have to install appropriate chrome-aws-lambda version.

In most cases, the

npm i next-api-og-image chrome-aws-lambda
# or
yarn add next-api-og-image chrome-aws-lambda

will be sufficient.

But when you'll encounter serverless function size exceed limit on Vercel:

npm i next-api-og-image [email protected]
# or
yarn add next-api-og-image [email protected]

The 6.0.0 version of chrome-aws-lambda is smaller than the latest one (10.1.0 at the time of writing this release notes)

Acknowledgements

Gargantuan thanks to @transitive-bullshit for making research on this 🙏🏻

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/3.0.0...4.0.1

3.0.0

2 years ago

BREAKING CHANGE:

Removed contentType option in next-api-og-image configuration object. From now on, the type property is its successor. Available values for it are: png, webp, jpeg.

If type is set to jpeg (works only for this particular type!!), the quality option can be set. If the type will be different than jpeg, the quality option will simply do nothing.

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/2.2.1...3.0.0

2.2.1

2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/2.2.0...2.2.1

2.2.0

2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/neg4n/next-api-og-image/compare/2.1.1...2.2.0

2.1.1

2 years ago
  • Fix critical bug that leaded to error informing about invalid chromium executable in serverless environment. (it was related to invalid detection of process.env.NODE_END)
  • Fix lack of presence of errorsInResponse in query strategy checks
  • Remove throw if strategy is set to query and its empty. This was not an error behaviour.