Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: There was a problem with the database: Specify a namespace to use #127

Closed
2 tasks done
alniswar19 opened this issue Sep 20, 2024 · 2 comments · May be fixed by #129
Closed
2 tasks done

Bug: There was a problem with the database: Specify a namespace to use #127

alniswar19 opened this issue Sep 20, 2024 · 2 comments · May be fixed by #129
Labels
bug Something isn't working

Comments

@alniswar19
Copy link

Describe the bug

After updating to surreal 2.0, using the same code to query throws error as follows

SurrealDb.Net.Exceptions.SurrealDbErrorResultException: Request problems detected
There was a problem with the database: Specify a namespace to use

   at SurrealDb.Net.Internals.SurrealDbHttpEngine.EnsuresFirstResultOk(SurrealDbResponse dbResponse) in /_/SurrealDb.Net/Internals/SurrealDbEngine.Http.cs:line 1030

   at SurrealDb.Net.Internals.SurrealDbHttpEngine.Select[T](String table, CancellationToken cancellationToken) in /_/SurrealDb.Net/Internals/SurrealDbEngine.Http.cs:line 481

Steps to reproduce

Here is my code

private readonly ISurrealDbClient _surrealDbClient;

public UserController(ISurrealDbClient surrealDbClientt)
{
    _surrealDbClient = surrealDbClient;
}

// GET: api/<UserController>
[HttpGet]
public async Task<IActionResult> Get(CancellationToken cancellationToken)
{
     var result = await _surrealDbClient.Select<User>("user", cancellationToken);
     return Ok(result);
}

Expected behaviour

returns the data correctly.

SurrealDB version

surreal 2.0

Package version(s)

Project 'orion.AppHost' has the following package references
   [net8.0]:
   Top-level Package                              Requested   Resolved
   > Aspire.Dashboard.Sdk.win-x64           (A)   [8.2.0, )   8.2.0
   > Aspire.Hosting.AppHost                       8.2.0       8.2.0
   > Aspire.Hosting.NodeJs                        8.2.0       8.2.0
   > Aspire.Hosting.Orchestration.win-x64   (A)   [8.2.0, )   8.2.0
   > Aspire.Hosting.Redis                         8.2.0       8.2.0
   > Aspire.Hosting.Seq                           8.2.0       8.2.0

Project 'orion.ServiceDefaults' has the following package references
   [net8.0]:
   Top-level Package                                   Requested   Resolved
   > Microsoft.Extensions.Http.Resilience              8.8.0       8.8.0
   > Microsoft.Extensions.ServiceDiscovery             8.2.0       8.2.0
   > OpenTelemetry.Exporter.OpenTelemetryProtocol      1.9.0       1.9.0
   > OpenTelemetry.Extensions.Hosting                  1.9.0       1.9.0
   > OpenTelemetry.Instrumentation.AspNetCore          1.9.0       1.9.0
   > OpenTelemetry.Instrumentation.Http                1.9.0       1.9.0
   > OpenTelemetry.Instrumentation.Runtime             1.9.0       1.9.0

Project 'orion.ApiService' has the following package references
   [net8.0]:
   Top-level Package                        Requested   Resolved
   > Aspire.Seq                             8.2.0       8.2.0
   > Swashbuckle.AspNetCore.SwaggerGen      6.7.3       6.7.3
   > Swashbuckle.AspNetCore.SwaggerUI       6.7.3       6.7.3

Project 'orion.Tests' has the following package references
   [net8.0]:
   Top-level Package                Requested   Resolved
   > Aspire.Hosting.Testing         8.2.0       8.2.0
   > coverlet.collector             6.0.2       6.0.2
   > Microsoft.NET.Test.Sdk         17.10.0     17.10.0
   > xunit                          2.9.0       2.9.0
   > xunit.runner.visualstudio      2.8.2       2.8.2

Project 'orion.Domain' has the following package references
   [net8.0]:
   Top-level Package      Requested   Resolved
   > SurrealDb.Net        0.5.1       0.5.1

Project 'orion.Infrastructure' has the following package references
   [net8.0]: No packages were found for this framework.
The project `C:\Work\Git\orion\orion.front\orion.front.esproj` uses package.config for NuGet packages, while the command works only with package reference projects.

Contact Details

[email protected]

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@alniswar19 alniswar19 added the bug Something isn't working label Sep 20, 2024
NakanoMiku13 added a commit to NakanoMiku13/surrealdb.net that referenced this issue Oct 5, 2024
The SDK was encountering errors with various operations (e.g., QUERY, RAWQUERY, SET, UPSERT) that interact directly with the database. This commit fixes the issue for SurrealDB V2.X, but it is not compatible with V1.X.
Fixes surrealdb#127:
Changes included:
-  Updated const strings for HTTP request headers from 'NS' to 'surrealdb-ns' and 'DB' to 'surrealdb-db'.
@AdaptGit
Copy link

Yea i have this same issues can provide extra info if requred.

@Odonno
Copy link
Contributor

Odonno commented Nov 19, 2024

Hello @AdaptGit

This issue exists due to the use of an outdated package that was not compatible with SurrealDB. You should use SurrealDb.Net v0.6.0 or later if using SurrealDB v2.X.

If it happens you have an issue with SurrealDb.Net v0.6.0, then I suggest you to create a new issue and provide some context about the problem.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants