SciCatProject / SciCatProject/backend
User cannot update published Dataset (500 error)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 37
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 38
Description
Issue Name
User cannot update published Dataset
Summary
One of our users who has published a dataset is unable to update metadata afterwards. They tried to update the Related Publications array but the server returned a {"statusCode":500,"message":"Internal server error"}
Steps to Reproduce
Create a published dataset and click "Edit", this shows the same fields but in edit-mode. Click "Update Published Data" to get the error.
Current Behaviour
User cannot update published metadata.
Expected Behaviour
User should be able to edit published metadata, given they have correct access rights.
Extra Details
From the logs:
[32m[Nest] 1 - [39m10/23/2023, 9:01:10 AM [32m LOG[39m [32mStatic access group getAccessGroups : [39m
<ref *2> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError],
socket: [ [Function: handleRequestSocket], [Function: destroyOnTimeout] ]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
maxRedirects: '5',
maxBodyLength: Infinity,
protocol: 'http:',
path: '/undefined',
method: 'PUT',
headers: [Object: null prototype] {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json;charset=UTF-8',
'User-Agent': 'axios/1.4.0',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
agents: { http: undefined, https: undefined },
auth: 'removed:removed',
family: undefined,
lookup: undefined,
beforeRedirect: [Function: dispatchBeforeRedirect],
beforeRedirects: { proxy: [Function: beforeRedirect] },
hostname: 'localhost',
port: '',
agent: undefined,
nativeProtocols: { 'http:': [Object], 'https:': [Object] },
pathname: '/undefined'
},
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: <ref *1> ClientRequest {
_events: [Object: null prototype] {
response: [Function],
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: Socket {
connecting: false,
_hadError: true,
_parent: null,
_host: 'localhost',
_closeAfterHandlingError: false,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: 'PUT /undefined HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json;charset=UTF-8\r\n' +
'User-Agent: axios/1.4.0\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: localhost\r\n' +
'Authorization: Basic cmVtb3ZlZDpyZW1vdmVk\r\n' +
'Connection: close\r\n' +
'Content-Length: 0\r\n' +
'\r\n',
_pendingEncoding: 'latin1',
server: null,
_server: null,
parser: null,
_httpMessage: [Circular *1],
timeout: 5000,
[Symbol(async_id_symbol)]: 4594011,
[Symbol(kHandle)]: null,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: -1,
_idlePrev: null,
_idleNext: null,
_idleStart: 1217681708,
_onTimeout: null,
_timerArgs: undefined,
_repeat: null,
_destroyed: true,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 4594018,
[Symbol(triggerId)]: 4594013
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: true,
[Symbol(kSetKeepAlive)]: true,
[Symbol(kSetKeepAliveInitialDelay)]: 60,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_header: 'PUT /undefined HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'Content-Type: application/json;charset=UTF-8\r\n' +
'User-Agent: axios/1.4.0\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: localhost\r\n' +
'Authorization: Basic cmVtb3ZlZDpyZW1vdmVk\r\n' +
'Connection: close\r\n' +
'Content-Length: 0\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 80,
protocol: 'http:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype],
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'PUT',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/undefined',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'localhost',
protocol: 'http:',
_redirectable: [Circular *2],
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
'user-agent': [Array],
'accept-encoding': [Array],
host: [Array],
authorization: [Array]
},
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 16384,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'http://removed:removed@localhost/undefined',
_timeout: null,
[Symbol(kCapture)]: false
}
[31m[Nest] 1 - [39m10/23/2023, 9:01:38 AM [31m ERROR[39m [38;5;3m[ExceptionsHandler] [39m[31mConverting circular structure to JSON
--> starting at object with constructor 'Socket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle[39m
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Socket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle
at JSON.stringify (<anonymous>)
at ConsoleLogger.stringifyMessage (/home/node/app/node_modules/@nestjs/common/services/console-logger.service.js:142:66)
at ConsoleLogger.formatMessage (/home/node/app/node_modules/@nestjs/common/services/console-logger.service.js:132:29)
at /home/node/app/node_modules/@nestjs/common/services/console-logger.service.js:121:43
at Array.forEach (<anonymous>)
at ConsoleLogger.printMessages (/home/node/app/node_modules/@nestjs/common/services/console-logger.service.js:116:18)
at ConsoleLogger.error (/home/node/app/node_modules/@nestjs/common/services/console-logger.service.js:51:14)
at Logger.error (/home/node/app/node_modules/@nestjs/common/services/logger.service.js:44:75)
at descriptor.value (/home/node/app/node_modules/@nestjs/common/services/logger.service.js:165:27)
at Logger.error (/home/node/app/node_modules/@nestjs/common/services/logger.service.js:76:79)```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the published Dataset update flow and includes a Nest error trace showing a PUT request to /undefined; begin by tracing that update entry point and the request/error logging path. Reproduce the edit of Related Publications, then verify the update succeeds for an authorized published dataset without the circular-structure logging failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100