4040 No such prepared statement

I’ve currently got an enterprise cluster that I have been developing some queries and code against. My queries have worked great against this cluster, but we’ve decided we want a separate cluster for the data that I am storing. We set up a community cluster, and I pointed my code to this new cluster. I can create and remove objects, but any time I execute a SELECT query I get a “4040 No such prepared statement”. If I execute a PREPARED statement, the error obviously goes away the next time I execute the query, but I have never had to do this on my other cluster and have written dozens of queries against that cluster. The same queries that are receiving the 4040 error on the community cluster don’t have this issue on the enterprise cluster.

Any ideas? I’ve compared the service level query settings and they are all the same between the two servers. I followed the tips listed on the 4040 issue when upgrading to 6.5 page, and I’ve restarted both my service and the cluster a couple of times now. I also need to try the “auto-prepare” service-level query setting, but as I understand that is disabled for queries with parameters, and I use several queries with named parameters. My enterprise cluster also has that set to false and is working fine.

Will you provide couchbase cluster version and SDK type and version. cc @Marco_Greco

No such prepared error:
Cluster: Couchbase Server Community Edition 6.5.0 build 4966
SDK: CouchbaseNetClient 2.7.17.

Works fine with same code
Cluster: Couchbase Server Enterprise Edition 6.5.0 build 4960
SDK: CouchbaseNetClient 2.7.17

I’ll take a look at upgrading versions and see if that helps, but it is still odd to me that queries work fine against one cluster and not against the other.

This is a known incompatibility between SDKs earlier than 3.0 and 6.5.
Your workarounds are here:
https://docs.couchbase.com/server/6.5/install/upgrade-strategy-for-features.html#prepared-statements

Either upgrade .NET to 3.0 (I’m unsure if it was fixed in 2.7 in .NET), or increase the prepared statement cache size, or change the n1ql feature controls from 12 to 8 in the UI settings.

I’ve tried the prepared statement cache size fix, as well as the n1ql feature controls change, but neither fixed it. I will try the SDK upgrade to 3.0, but I am still confused why the SDK works fine against my 6.5.0 build 4960 cluster, and not my 6.5.0 build 4966 cluster.

Setting adHoc=true on the call made it work.