Eventing functions can't deploy with SGW on source bucket with read-write bucket alias

Description

I did a fresh install of couchbase-server GA 6.6.5
couchbase-server Enterprise Edition 6.6.5 build 10080

made two BUCKETS: metadata and primary

Did a fresh install of SGW 2.7.3-3

And I tested it out (made some docs in "primary") via sync_gateway

All work is done as full admin or user Administrator

I also set "allow_interbucket_recursion": true

=======

CASE: #1 CREATE  FUNCTION WORKS - Create any function in the UI with an initial "Bucket Alias" of "src_bkt" to "primary" in mode read-only

In the Evneting landing page hit "ADD FUNCTION" and fill in 
    primary
    metadata
    test_issue_a_ro
    Everything
    [ binding : bucket alias ]
        src_bkt, primary, read-only

I get code editor, no change
    "< back to Eventing"

The function saves just fine as expected (see image: {}1_test_issue_ro.PNG)

The Function "test_issue_a_ro" will DEPLOY (and run) and UNDEPLOY just fine.

Now when UNDEPLOYED go to settings and change the alias of src_bkt to mode "read and write" and save the altered settings.

Now try to DEPLOY the function "test_issue_a_ro"

The DEPLOY test_issue_a_ro (FAILS) despite setting "allow_interbucket_recursion": true - you will see the below pop-up on 6.6.5 (Note this works just fine on version 6.6.4)

deploy failed: with popup message:

    {"code":52,"info":"SyncGateway is enabled on: primary, deployement 
    of source bucket mutating handler will cause Intra Bucket Recursion"}

note deployment is misspelled in the message  ^^^^^

=======================
CASE: #2 CREATE  FUNCTION FAILS- Create any function in the UI with an initial "Bucket Alias" of "src_bkt" to "primary" in mode read and write

ADD FUNCTION
    primary
    metadata
    test_issue_a_rw
    Everything
    [ binding : bucket alias ]
        src_bkt, primary, read-only

A) I get code editor, no change
    "< back to Eventing"
    
We see "..." for 15 seconds and then the Function disappears or auto deletes (no user error message or feedback happens the user is left baffled)

=======================
CASE: #3 CREATE  FUNCTION FAILS- Create any function in the UI with an initial "Bucket Alias" of "src_bkt" to "primary" in mode read and write

ADD FUNCTION
    primary
    metadata
    test_issue_a_rw
    Everything
    [ binding : bucket alias ]
        src_bkt, primary, read-only

Change the code and try to hit "SAVE" nothing happens you are stuck in the code editor (no user error message or feedback happens again the user is left baffled)

=======================

CASE: #1 CASE: #2 and CASE #3 all happen sync_gateway is running and even if I stop SGW via:

But if I also flush the SGW bucket "primary" (with sync_gateway down of course)  CASE: #1, CASE: #2 and CASE #3 are fine and all work as expected.

=======================

OTHER:

Now in 6.6.5 you CAN deploy your function with a "read and write" alias to the bucket "primary" shared with SGW with an empty sync_gateway bucket and then start sync_gateway and it appears to work fine

  • systemctl stop sync_gateway

  • FLUSH primary bucket 

  • DEPLOY test_issue_a_rw

  • systemctl start sync_gateway

Obviously you can not do the above in production as you need to NUKE the sync_gateway bucket every time.

Components

Affects versions

Fix versions

Labels

Environment

None

Release Notes Description

None

Activity

Show:
CB Robot
February 25, 2025 at 1:48 AM

Build couchbase-columnar-1.2.0-1009 contains eventing commit d1cb752 with commit message:
MB-50944 : Allowing user to enable Sync Gateway Mutations for deployment of an eventing function

CB Robot
February 25, 2025 at 1:48 AM

Build couchbase-columnar-1.2.0-1009 contains eventing commit 8271802 with commit message:
MB-50944 : Introduce new function level setting "cursor_aware"

CB Robot
February 25, 2025 at 1:48 AM

Build couchbase-columnar-1.2.0-1009 contains eventing commit 5cc9b73 with commit message:
MB-50944 : Skip "_sync:" prefixed mutations

CB Robot
February 25, 2025 at 1:48 AM

Build couchbase-columnar-1.2.0-1009 contains eventing commit d70edf4 with commit message:
MB-50944 : Add cas to _eventing xattr on SBM

CB Robot
February 25, 2025 at 1:48 AM

Build couchbase-columnar-1.2.0-1009 contains eventing commit 5f976c5 with commit message:
MB-50944 : Check for import mutations and address infinite recursion

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Issue Impact

Due date

Story Points

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created February 11, 2022 at 7:16 PM
Updated April 11, 2025 at 1:41 AM
Resolved May 20, 2024 at 4:46 PM
Instabug