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

"There is an error with your API connection: Unexpected token < in JSON at position 0" #187

Open
aep opened this issue Jul 10, 2022 · 2 comments

Comments

@aep
Copy link
Contributor

aep commented Jul 10, 2022

following https://ohmyform.com/docs/install/ it says

"For smaller installations, the combined image will be sufficient."

but the image has no further documentation. just starting it with docker run does not work.
the browser outputs

"There is an error with your API connection: Unexpected token < in JSON at position 0"

and the browser console shows a 404 for "http://localhost:4000/graphql"

docker output


 docker run --net host -ti ohmyform/ohmyform 
2022-07-10 18:29:30,730 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2022-07-10 18:29:30,731 INFO supervisord started with pid 1
2022-07-10 18:29:31,735 INFO spawned: 'api' with pid 8
2022-07-10 18:29:31,736 INFO spawned: 'nginx' with pid 9
2022-07-10 18:29:31,737 INFO spawned: 'ui' with pid 10
2022/07/10 18:29:31 [notice] 9#9: using the "epoll" event method
2022/07/10 18:29:31 [notice] 9#9: nginx/1.20.2
2022/07/10 18:29:31 [notice] 9#9: OS: Linux 5.18.9-arch1-1
2022/07/10 18:29:31 [notice] 9#9: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/07/10 18:29:31 [notice] 9#9: start worker processes
2022/07/10 18:29:31 [notice] 9#9: start worker process 28
yarn run v1.22.17
yarn run v1.22.17
$ /usr/src/ui/node_modules/.bin/next start -p 4000
$ cross-env NODE_ENV=production node dist/main
ready - started server on 0.0.0.0:4000, url: http://localhost:4000
2022-07-10 18:29:32,988 INFO success: api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-07-10 18:29:32,988 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-07-10 18:29:32,988 INFO success: ui entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
{"level":40,"time":1657477773340,"pid":66,"hostname":"whale","msg":"without redis graphql subscriptions will be unreliable in load balanced environments"}
{"level":30,"time":1657477773798,"pid":66,"hostname":"whale","context":"InstallationMetricsService","msg":"try to add startup metric"}
{"level":30,"time":1657477773810,"pid":66,"hostname":"whale","context":"NestFactory","msg":"Starting Nest application..."}
{"level":30,"time":1657477773810,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"TypeOrmModule dependencies initialized"}
{"level":30,"time":1657477773810,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"MailerModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"HttpModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"ConfigHostModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"LoggerModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"ServeStaticModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"ConsoleModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"ConfigModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"ConfigModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"MailerCoreModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"JwtModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"GraphQLSchemaBuilderModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"GraphQLModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"TypeOrmCoreModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"TypeOrmModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"InstanceLoader","msg":"AppModule dependencies initialized"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"RoutesResolver","msg":"HealthController {/}:"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"RouterExplorer","msg":"Mapped {/_health, GET} route"}
{"level":30,"time":1657477773811,"pid":66,"hostname":"whale","context":"NestApplication","msg":"Nest application successfully started"}

the exact same thing happens with the "production" process that recommends you setup postgres, redis, etc. It doesn't output any different error message indicating postgres or redis can't be reached. Just the 404 and the obscure syntax error.

@wodka
Copy link
Contributor

wodka commented Jul 20, 2022

The problem looks like the /graphql endpoint is not available to the frontend.

@wodka
Copy link
Contributor

wodka commented Jul 20, 2022

@aep are you just using the minimal image without modifications? it should pass the /graphql endpoint to the api backend so it can work together with the ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants