Record Bin v3.0.14: Lambda-less restore fails because ctx is undefined
Description
Restoring records in Lambda-less mode fails with the following alert:
The record could not be restored!
No detailed restoration error panel appears after dismissing the alert.
Deleting records and archiving them in the Record Bin collection works correctly. The failure occurs only when attempting to restore an archived record.
Steps to reproduce
- Install Record Bin v3.0.14.
- Use the default Lambda-less runtime.
- Create and delete a record.
- Open the resulting Record Bin entry.
- Click Restore record.
Actual result
The generic “The record could not be restored!” alert appears. The record is not restored, and no detailed error report is shown.
Expected result
The record should be restored through the Content Management API. If the CMA rejects the payload, the detailed restoration error panel should be displayed.
Suspected cause
In record-bin/src/entrypoints/BinOutlet.tsx, the top-level executeRestoreWithoutLambda() function references:
cmaBaseUrl: ctx.cmaBaseUrl
However, ctx does not appear to be in scope inside that function. This may cause:
ReferenceError: ctx is not defined
The error is not a LambdaLessRestoreError, so it appears to be rethrown and handled only by the outer generic error handler. This would explain both symptoms:
- The restoration request never reaches the CMA.
- setError() is never called, so the detailed restoration error panel is not rendered.
The suspected regression appears related to this commit:
https://github.com/datocms/plugins/commit/94895ccd67ff6a9bb2b0250354f5591d61d39704
Affected source:
https://github.com/datocms/plugins/blob/master/record-bin/src/entrypoints/BinOutlet.tsx
Environment
- Plugin: datocms-plugin-record-bin
- Version: 3.0.14
- Runtime: Lambda-less
Record Bin v3.0.14: Lambda-less restore fails because
ctxis undefinedDescription
Restoring records in Lambda-less mode fails with the following alert:
No detailed restoration error panel appears after dismissing the alert.
Deleting records and archiving them in the Record Bin collection works correctly. The failure occurs only when attempting to restore an archived record.
Steps to reproduce
Actual result
The generic “The record could not be restored!” alert appears. The record is not restored, and no detailed error report is shown.
Expected result
The record should be restored through the Content Management API. If the CMA rejects the payload, the detailed restoration error panel should be displayed.
Suspected cause
In
record-bin/src/entrypoints/BinOutlet.tsx, the top-levelexecuteRestoreWithoutLambda()function references: