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

Fix server errors #7931

Merged
merged 2 commits into from
Nov 12, 2021
Merged
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
1 change: 1 addition & 0 deletions airbyte-e2e-testing/cypress.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"baseUrl": "http://localhost:3000",
"testFiles": [
"base.spec.js",
"onboarding.spec.js",
"connection.spec.js",
"destination.spec.js",
Expand Down
30 changes: 30 additions & 0 deletions airbyte-e2e-testing/cypress/integration/base.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
describe("Error handling view", () => {
it("Shows Version Mismatch page", () => {
cy.intercept("/api/v1/**", {
statusCode: 500,
body: {
error:
"Version mismatch between 0.0.1-ci and 0.0.2-ci.\nPlease upgrade or reset your Airbyte Database, see more at https://docs.airbyte.io/operator-guides/upgrading-airbyte",
},
});

cy.visit("/");

cy.get("div")
.contains("Version mismatch between 0.0.1-ci and 0.0.2-ci.")
.should("exist");
});

it("Shows Server Unavailable page", () => {
cy.intercept("/api/v1/**", {
statusCode: 502,
body: "Failed to fetch",
});

cy.visit("/");

cy.get("div")
.contains("Cannot reach server. The server may still be starting up.")
.should("exist");
});
});
38 changes: 19 additions & 19 deletions airbyte-webapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,7 @@ const services = {

const AppServices: React.FC = ({ children }) => (
<ServicesProvider inject={services}>
<ConfigServiceProvider
defaultConfig={defaultConfig}
providers={configProviders}
>
<ServiceOverrides>{children}</ServiceOverrides>
</ConfigServiceProvider>
<ServiceOverrides>{children}</ServiceOverrides>
</ServicesProvider>
);

Expand All @@ -101,19 +96,24 @@ const App: React.FC = () => {
<I18NProvider>
<StoreProvider>
<Suspense fallback={<LoadingPage />}>
<ApiErrorBoundary>
<FeatureService features={Features}>
<NotificationService>
<AppServices>
<AnalyticsInitializer>
<OnboardingServiceProvider>
<Routing />
</OnboardingServiceProvider>
</AnalyticsInitializer>
</AppServices>
</NotificationService>
</FeatureService>
</ApiErrorBoundary>
<ConfigServiceProvider
defaultConfig={defaultConfig}
providers={configProviders}
>
<ApiErrorBoundary>
<FeatureService features={Features}>
<NotificationService>
<AppServices>
<AnalyticsInitializer>
<OnboardingServiceProvider>
<Routing />
</OnboardingServiceProvider>
</AnalyticsInitializer>
</AppServices>
</NotificationService>
</FeatureService>
</ApiErrorBoundary>
</ConfigServiceProvider>
</Suspense>
</StoreProvider>
</I18NProvider>
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/config/ConfigServiceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const configContext = React.createContext<ConfigContext | null>(null);
export function useConfig<T extends Config>(): T {
const configService = useContext(configContext);

if (!configService) {
if (configService === null) {
throw new Error("useConfig must be used within a ConfigProvider");
}

Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/config/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const defaultConfig: Config = {
ui: uiConfig,
segment: { enabled: true, token: "" },
healthCheckInterval: 10000,
version: "",
version: "dev",
apiUrl: `${window.location.protocol}//${window.location.hostname}:8001/api/v1/`,
integrationUrl: "/docs",
oauthRedirectUrl: `${window.location.protocol}//${window.location.host}`,
Expand Down
33 changes: 18 additions & 15 deletions airbyte-webapp/src/packages/cloud/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Feature, FeatureItem, FeatureService } from "hooks/services/Feature";
import { AuthenticationProvider } from "packages/cloud/services/auth/AuthService";
import { AppServicesProvider } from "./services/AppServicesProvider";
import { IntercomProvider } from "./services/IntercomProvider";
import { ConfigProvider } from "./services/ConfigProvider";

const messages = Object.assign({}, en, cloudLocales);

Expand Down Expand Up @@ -55,21 +56,23 @@ const App: React.FC = () => {
<I18NProvider>
<StoreProvider>
<Suspense fallback={<LoadingPage />}>
<ApiErrorBoundary>
<NotificationServiceProvider>
<FeatureService features={Features}>
<AppServicesProvider>
<AuthenticationProvider>
<IntercomProvider>
<AnalyticsInitializer>
<Routing />
</AnalyticsInitializer>
</IntercomProvider>
</AuthenticationProvider>
</AppServicesProvider>
</FeatureService>
</NotificationServiceProvider>
</ApiErrorBoundary>
<ConfigProvider>
<ApiErrorBoundary>
<NotificationServiceProvider>
<FeatureService features={Features}>
<AppServicesProvider>
<AuthenticationProvider>
<IntercomProvider>
<AnalyticsInitializer>
<Routing />
</AnalyticsInitializer>
</IntercomProvider>
</AuthenticationProvider>
</AppServicesProvider>
</FeatureService>
</NotificationServiceProvider>
</ApiErrorBoundary>
</ConfigProvider>
</Suspense>
</StoreProvider>
</I18NProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
useInjectServices,
} from "core/servicesProvider";
import { useApiServices } from "core/defaultServices";
import { ConfigProvider } from "./ConfigProvider";
import { FirebaseSdkProvider } from "./FirebaseSdkProvider";

import { useWorkspaceService } from "./workspaces/WorkspacesService";
Expand Down Expand Up @@ -50,11 +49,9 @@ const AppServicesProvider: React.FC = ({ children }) => {
);
return (
<ServicesProvider inject={services}>
<ConfigProvider>
<FirebaseSdkProvider>
<ServiceOverrides>{children}</ServiceOverrides>
</FirebaseSdkProvider>
</ConfigProvider>
<FirebaseSdkProvider>
<ServiceOverrides>{children}</ServiceOverrides>
</FirebaseSdkProvider>
</ServicesProvider>
);
};
Expand Down