Failed to create postgresql source

  • Is this your first time deploying Airbyte?: Yes
  • OS Version / Instance: Ubuntu 18.04
  • Memory / Disk: 16Gb
  • Deployment: Docker
  • Airbyte Version: 0.39.37-alpha
  • Source name/version: Postgres Beta
  • Destination name/version: N/A
  • Step: Source creation
  • Description: Source creation fails with foreign key constraint violation.

After I first started airbyte, I was able to create sources, etc. After stopping (docker-compose down -v) and restarting airbyte I am not longer able to create a postgres source. I haven’t tried other sources. Any help would be appreciated. Thanks.

Log:

org.jooq.exception.DataAccessException: SQL [insert into "public"."actor" ("id", "workspace_id", "actor_definition_id", "name", "configuration", "actor_type", "tombstone", "created_at", "updated_at") values (cast(? as uuid), cast(? as uuid), cast(? as uuid), ?, cast(? as jsonb), ?::"public"."actor_type", ?, cast(? as timestamp with time zone), cast(? as timestamp with time zone))]; ERROR: insert or update on table "actor" violates foreign key constraint "actor_workspace_id_fkey"
  Detail: Key (workspace_id)=(05148684-3bf5-49d1-9a73-b87f4100983e) is not present in table "workspace".
	at org.jooq_3.13.4.POSTGRES.debug(Unknown Source) ~[?:?]
	at org.jooq.impl.Tools.translate(Tools.java:2753) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:755) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:385) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:119) ~[jooq-3.13.4.jar:?]
	at io.airbyte.config.persistence.DatabaseConfigPersistence.lambda$writeSourceConnection$35(DatabaseConfigPersistence.java:898) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
	at io.airbyte.config.persistence.DatabaseConfigPersistence.writeSourceConnection(DatabaseConfigPersistence.java:870) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.DatabaseConfigPersistence.lambda$writeSourceConnection$34(DatabaseConfigPersistence.java:863) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.db.Database.lambda$transaction$0(Database.java:27) ~[io.airbyte.airbyte-db-db-lib-0.39.37-alpha.jar:?]
	at org.jooq.impl.DefaultDSLContext.lambda$transactionResult0$0(DefaultDSLContext.java:564) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.Tools$12$1.block(Tools.java:4926) ~[jooq-3.13.4.jar:?]
	at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3463) ~[?:?]
	at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3434) ~[?:?]
	at org.jooq.impl.Tools$12.get(Tools.java:4923) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.DefaultDSLContext.transactionResult0(DefaultDSLContext.java:616) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:533) ~[jooq-3.13.4.jar:?]
	at io.airbyte.db.Database.transaction(Database.java:27) ~[io.airbyte.airbyte-db-db-lib-0.39.37-alpha.jar:?]
	at io.airbyte.db.ExceptionWrappingDatabase.transaction(ExceptionWrappingDatabase.java:31) ~[io.airbyte.airbyte-db-db-lib-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.DatabaseConfigPersistence.writeSourceConnection(DatabaseConfigPersistence.java:862) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.DatabaseConfigPersistence.writeConfigs(DatabaseConfigPersistence.java:1263) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.ValidatingConfigPersistence.writeConfigs(ValidatingConfigPersistence.java:89) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.ValidatingConfigPersistence.writeConfig(ValidatingConfigPersistence.java:80) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.ConfigRepository.writeSourceConnectionNoSecrets(ConfigRepository.java:541) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.config.persistence.SecretsRepositoryWriter.writeSourceConnection(SecretsRepositoryWriter.java:88) ~[io.airbyte.airbyte-config-config-persistence-0.39.37-alpha.jar:?]
	at io.airbyte.server.handlers.SourceHandler.persistSourceConnection(SourceHandler.java:309) ~[io.airbyte-airbyte-server-0.39.37-alpha.jar:?]
	at io.airbyte.server.handlers.SourceHandler.createSource(SourceHandler.java:94) ~[io.airbyte-airbyte-server-0.39.37-alpha.jar:?]
	at io.airbyte.server.apis.ConfigurationApi.lambda$createSource$27(ConfigurationApi.java:442) ~[io.airbyte-airbyte-server-0.39.37-alpha.jar:?]
	at io.airbyte.server.apis.ConfigurationApi.execute(ConfigurationApi.java:873) ~[io.airbyte-airbyte-server-0.39.37-alpha.jar:?]
	at io.airbyte.server.apis.ConfigurationApi.createSource(ConfigurationApi.java:442) ~[io.airbyte-airbyte-server-0.39.37-alpha.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) ~[jersey-common-2.31.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) ~[jersey-common-2.31.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292) ~[jersey-common-2.31.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274) ~[jersey-common-2.31.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:244) ~[jersey-common-2.31.jar:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) ~[jersey-common-2.31.jar:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680) ~[jersey-server-2.31.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394) ~[jersey-container-servlet-core-2.31.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346) ~[jersey-container-servlet-core-2.31.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366) ~[jersey-container-servlet-core-2.31.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319) ~[jersey-container-servlet-core-2.31.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205) ~[jersey-container-servlet-core-2.31.jar:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.Server.handle(Server.java:501) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556) [jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) [jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) [jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [jetty-io-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [jetty-io-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "actor" violates foreign key constraint "actor_workspace_id_fkey"
  Detail: Key (workspace_id)=(05148684-3bf5-49d1-9a73-b87f4100983e) is not present in table "workspace".
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675) ~[postgresql-42.3.5.jar:42.3.5]
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365) ~[postgresql-42.3.5.jar:42.3.5]
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355) ~[postgresql-42.3.5.jar:42.3.5]
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490) ~[postgresql-42.3.5.jar:42.3.5]
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408) ~[postgresql-42.3.5.jar:42.3.5]
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:167) ~[postgresql-42.3.5.jar:42.3.5]
	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:156) ~[postgresql-42.3.5.jar:42.3.5]
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) ~[HikariCP-5.0.1.jar:?]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) ~[HikariCP-5.0.1.jar:?]
	at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:209) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:453) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:904) ~[jooq-3.13.4.jar:?]
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:371) ~[jooq-3.13.4.jar:?]
	... 78 more
2022-07-15 19:26:27 e[1;31mERRORe[m i.a.s.RequestLogger(filter):110 - REQ 172.31.0.7 POST 500 /api/v1/sources/create - {"name":"Postgres","sourceDefinitionId":"decd338e-5647-4c0b-adf4-da0e75f5a750","workspaceId":"05148684-3bf5-49d1-9a73-b87f4100983e","connectionConfiguration":"REDACTED"}```

You’re trying to add a source using the API or the webapp?

Thanks for the quick reply. I’m trying to use the webapp.

I figured out the problem: I didn’t reconnect the webapp so it was still using an old workspace uuid. The webapp interacted with the new airbyte db but the workspace uuid’s no longer matched (hence the foreign key problem).

If you restart airbyte you need to restart the webapp so it gets the correct workspace uuid.

1 Like