Open
Conversation
70eb2e9 to
a83d393
Compare
06c07a7 to
f530cb4
Compare
f530cb4 to
646a9ca
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Releases
@red-hat-developer-hub/backstage-plugin-lightspeed-backend@1.4.0
Minor Changes
18aa761: BREAKING Replaces
fetchfunction with built-in one and refactors source to fit the change. This change comes from ADR014 that now recommends the use of the global built-infetchfunction since Node v20.The changes are contained for the
lightspeed-backendplugin, thenode-fetchdirect dependency is removed frompackage.jsonand makes the following changes to therouter.tssource:import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter'; import { NotAllowedError } from '@backstage/errors'; import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node'; import express, { Router } from 'express'; import { createProxyMiddleware } from 'http-proxy-middleware'; -import fetch from 'node-fetch'; import { lightspeedChatCreatePermission, lightspeedChatDeletePermission, lightspeedChatReadPermission, lightspeedPermissions, } from '@red-hat-developer-hub/backstage-plugin-lightspeed-common'; +import { Readable } from 'node:stream'; + import { userPermissionAuthorization } from './permission'; import { DEFAULT_HISTORY_LENGTH, QueryRequestBody, RouterOptions, } from './types'; import { validateCompletionsRequest } from './validation';Response piping has changed for the result of the built-in
fetch:if (!fetchResponse.ok) { // Read the error body const errorBody = await fetchResponse.json(); const errormsg = `Error from lightspeed-core server: ${errorBody.error?.message || errorBody?.detail?.cause || 'Unknown error'}`; logger.error(errormsg); // Return a 500 status for any upstream error response.status(500).json({ error: errormsg, }); + + return } // Pipe the response back to the original response -fetchResponse.body.pipe(response); +if (fetchResponse.body) { + const nodeStream = Readable.fromWeb(fetchResponse.body as any); + nodeStream.pipe(response); +}Patch Changes
mswto2.12.9.mswto2.12.8.@red-hat-developer-hub/backstage-plugin-lightspeed@1.4.0
Patch Changes
@red-hat-developer-hub/backstage-plugin-lightspeed-common@1.4.0
backend@0.0.32
Patch Changes