Skip to content

Record Bin v3.0.14: Lambda-less restore always fails because ctx is undefined #152

Description

@TD-Travel

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

  1. Install Record Bin v3.0.14.
  2. Use the default Lambda-less runtime.
  3. Create and delete a record.
  4. Open the resulting Record Bin entry.
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions