Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions harness/features/allFeatures.cloud.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ describe('allFeatures Tests - Cloud', () => {
})
})

// TODO DVC-5954 investigate why these were failing on the SDKs
it.skip('should throw if features request fails on invalid sdk key', async () => {
it('should throw if features request fails on invalid sdk key', async () => {
scope
.post(`/client/${testClient.clientId}/v1/features`)
.reply(401, { message: 'Invalid sdk key' })
Expand Down
12 changes: 5 additions & 7 deletions harness/features/initialize.local.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ describe('Initialize Tests - Local', () => {
await testClient.createClient(true, { configPollingIntervalMS: 10000 })
})

// TODO DVC-6016 investigate why these were failing on the nodeJS SDK
it.skip('stops the polling interval when the sdk key is invalid and cdn responds 403,' +
it('stops the polling interval when the sdk key is invalid and cdn responds 403,' +
' throws error', async () => {
const testClient = new LocalTestClient(name)

Expand All @@ -79,13 +78,12 @@ describe('Initialize Tests - Local', () => {

const response =
await testClient.createClient(true, { configPollingIntervalMS: 1000 }, testClient.sdkKey, true)
const { exception } = await response.json()
const { asyncError } = await response.json()

expectErrorMessageToBe(
exception,
asyncError,
'Invalid environment key provided. Please call initialize with a valid server environment key'
)

})

it('fetches config again after 3 seconds when config polling interval is overriden', async () => {
Expand Down Expand Up @@ -158,7 +156,7 @@ describe('Initialize Tests - Local', () => {

scope
.get(`/client/${testClient.clientId}/config/v1/server/${testClient.sdkKey}.json`)
.reply(200, "I'm not JSON!")
.reply(200, 'I\'m not JSON!')

await testClient.createClient(true, { configPollingIntervalMS: 1000 })

Expand All @@ -180,7 +178,7 @@ describe('Initialize Tests - Local', () => {

scope
.get(`/client/${testClient.clientId}/config/v1/server/${testClient.sdkKey}.json`)
.reply(200, "{\"snatch_movie_quote\": \"d'ya like dags?\"}")
.reply(200, '{"snatch_movie_quote": "d\'ya like dags?"}')

await testClient.createClient(true, { configPollingIntervalMS: 1000 })

Expand Down
1 change: 1 addition & 0 deletions harness/features/variable.cloud.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('Variable Tests - Cloud', () => {
// from the proxy server
expectErrorMessageToBe(error.asyncError, 'Missing parameter: key')
})

// TODO DVC-5954 investigate why these were failing on the SDKs
it.skip('will throw error if variable called with invalid sdk key', async () => {
scope
Expand Down
5 changes: 5 additions & 0 deletions proxies/dotnet/Controllers/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,15 @@ public async Task<object> Post(ClientRequestBody ClientBody)
.SetLogger(LoggerFactory.Create(builder => builder.AddConsole()))
.Build();

try {
await task;
if (eventArgs != null && !eventArgs.Success) {
throw eventArgs.Errors[0];
}
} catch (Exception e) {
Response.StatusCode = 200;
return new { asyncError = e.Message };
}
} else {
DataStore.LocalClients[ClientBody.ClientId] = new DVCLocalClientBuilder()
.SetEnvironmentKey(ClientBody.SdkKey)
Expand Down
6 changes: 5 additions & 1 deletion proxies/go/handler_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ func clientHandler(w http.ResponseWriter, r *http.Request) {
client, err := devcycle.NewDVCClient(reqBody.SdkKey, &options)

if err != nil {
res.Exception = err.Error()
if reqBody.WaitForInitialization {
res.AsyncError = err.Error()
} else {
res.Exception = err.Error()
}
w.WriteHeader(http.StatusOK)
} else {
res.Message = "success"
Expand Down