Closed asyncfncom closed 4 months ago
Problems wit Haskell are solved. I've got another problem with User
[Server] appname todoApp
[Server] POST /operations/start-generating-new-app 500 6.166 ms - 1470
[Server!] PrismaClientKnownRequestError:
[Server!] Invalid prisma.project.create()
invocation:
[Server!]
[Server!]
[Server!] An operation failed because it depends on one or more records that were required but not found. No 'User' record(s) (needed to inline the relation on 'Project' record(s)) was found for a nested connect on one-to-many relation 'ProjectToUser'.
[Server!] at Rn.handleRequestError (/home/michal/projects/project_octopus/octopus_server/wasp_mage/.wasp/out/server/node_modules/.prisma/client/runtime/library.js:174:7325)
[Server!] at Rn.handleAndLogRequestError (/home/michal/projects/project_octopus/octopus_server/wasp_mage/.wasp/out/server/node_modules/.prisma/client/runtime/library.js:174:6754)
[Server!] at Rn.request (/home/michal/projects/project_octopus/octopus_server/wasp_mage/.wasp/out/server/node_modules/.prisma/client/runtime/library.js:174:6344)
[Server!] at async startGeneratingNewApp (file:///home/michal/projects/project_octopus/octopus_server/wasp_mage/.wasp/out/server/dist/ext-src/operations.js:17:21)
[Server!] at async file:///home/michal/projects/project_octopus/octopus_server/wasp_mage/.wasp/out/server/dist/middleware/operations.js:9:24
[Server!] at async file:///home/michal/projects/project_octopus/octopus_server/wasp_mage/.wasp/out/server/dist/utils.js:15:9
I've got another problem. This time in container.
[Server]
[Server] > server@0.0.0 start
[Server] > npm run validate-env && NODE_PATH=dist node -r dotenv/config dist/server.js
[Server]
[Server]
[Server] > server@0.0.0 validate-env
[Server] > node -r dotenv/config ./scripts/validate-env.mjs
[Server]
[Server] 🔍 Validating environment variables...
[Server] 🚀 "Username and password" auth initialized
[Server!] pg-boss failed to start!
[Server!] error: no pg_hba.conf entry for host "10.1.88.234", user "octopus", database "wasp_mage", no encryption
[Server!] at /wasp_mage/.wasp/out/server/node_modules/pg-pool/index.js:45:11
[Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Server!] at async Db.executeSql (/wasp_mage/.wasp/out/server/node_modules/pg-boss/src/db.js:28:14)
[Server!] at async Contractor.isInstalled (/wasp_mage/.wasp/out/server/node_modules/pg-boss/src/contractor.js:32:20)
[Server!] at async Contractor.start (/wasp_mage/.wasp/out/server/node_modules/pg-boss/src/contractor.js:37:23)
[Server!] at async PgBoss.start (/wasp_mage/.wasp/out/server/node_modules/pg-boss/src/index.js:103:5)
[Server!] at async startPgBoss (file:///wasp_mage/.wasp/out/server/dist/jobs/core/pgBoss/pgBoss.js:52:9)
[Server!] at async startServer (file:///wasp_mage/.wasp/out/server/dist/server.js:7:5) {
[Server!] length: 159,
[Server!] severity: 'FATAL',
[Server!] code: '28000',
[Server!] detail: undefined,
[Server!] hint: undefined,
[Server!] position: undefined,
[Server!] internalPosition: undefined,
[Server!] internalQuery: undefined,
[Server!] where: undefined,
[Server!] schema: undefined,
[Server!] table: undefined,
[Server!] column: undefined,
[Server!] dataType: undefined,
[Server!] constraint: undefined,
[Server!] file: 'auth.c',
[Server!] line: '543',
[Server!] routine: 'ClientAuthentication'
[Server] Starting pg-boss...
[Server!] }
[Server!] node:internal/process/promises:288
[Server!] triggerUncaughtException(err, true /* fromPromise */);
[Server!] ^
[Server!]
[Server!] [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<PgBoss>".] {
[Server!] code: 'ERR_UNHANDLED_REJECTION'
[Server!] }
[Server!]
[Server] Server listening on port 3031
[Server!] Node.js v18.19.0Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
[Server] [nodemon] app crashed - waiting for file changes before starting... ✓ Compiled successfully
Can you have a look at the code and suggest what may be wrong? Server runs succesfully on my local, just crashes in container.
Ok, so now after fixing a previous problem in container I have this again
<pre>PrismaClientKnownRequestError: <br>Invalid `prisma.project.create()` invocation:<br><br><br>An operation failed because it depends on one or more records that were required but not found. No 'User' record(s) (needed to inline the relation on 'Project' record(s)) was found for a nested connect on one-to-many relation 'ProjectToUser'.<br> at Rn.handleRequestError (/wasp_mage/.wasp/out/server/node_modules/.prisma/client/runtime/library.js:174:7325)<br> at Rn.handleAndLogRequestError (/wasp_mage/.wasp/out/server/node_modules/.prisma/client/runtime/library.js:174:6754)<br> at Rn.request (/wasp_mage/.wasp/out/server/node_modules/.prisma/client/runtime/library.js:174:6344)<br> at async startGeneratingNewApp (file:///wasp_mage/.wasp/out/server/dist/ext-src/operations.js:17:21)<br> at async file:///wasp_mage/.wasp/out/server/dist/middleware/operations.js:9:24<br> at async file:///wasp_mage/.wasp/out/server/dist/utils.js:15:9</pre>
In Docker we have a Haskell installation for WASP mage done this way
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
ENV PATH "$PATH:/root/.ghcup/bin"
RUN ghcup install ghc 8.10.7
I create an app
curl --header "Content-Type: application/json" \
--request POST \
--data '{"json":{"appAuthMethod":"usernameAndPassword","appCreativityLevel":"balanced","appDesc":"todo app","appName":"todoApp","appPrimaryColor":"sky"}}' \
http://localhost:4031/operations/start-generating-new-app
{"json":"58b1d069-b444-44ca-b83c-95f362940c14"}
Here is what I see in database
id | name | description | createdAt | status | primaryColor | authMethod | creativityLevel | referrer | zipDownloadedAt
--------------------------------------+---------+-------------+-------------------------+---------+--------------+---------------------+-----------------+----------+-----------------
58b1d069-b444-44ca-b83c-95f362940c14 | todoApp | todo app | 2024-03-15 10:43:48.276 | success | sky | usernameAndPassword | balanced | unknown |
(1 row)
SELECT * FROM "Log" ;
id | content | createdAt | projectId
----+---------+-----------+-----------
(0 rows)
SELECT * FROM "File" ;
id | name | content | createdAt | projectId
----+------+---------+-----------+-----------
(0 rows)
When I check status
curl --header "Content-Type: application/json" --request POST --data '{"json":{"appId":"58b1d069-b444-44ca-b83c-95f362940c14"}}' http://localhost:4031/operations/get-app-generation-result
{"json":{"project":{"id":"58b1d069-b444-44ca-b83c-95f362940c14","name":"todoApp","description":"todo app","primaryColor":"sky","authMethod":"usernameAndPassword","creativityLevel":"balanced","createdAt":"2024-03-15T10:43:48.276Z","status":"success","referrer":"unknown","zipDownloadedAt":null,"files":[],"logs":[]},"numberOfProjectsAheadInQueue":1},"meta":{"values":{"project.createdAt":["Date"]}}
When I try to download
curl --header "Content-Type: application/json" \ curl --header "Content-Type: application/json" \
--request POST \
--data '{"json":{"appId":"58b1d069-b444-44ca-b83c-95f362940c14"}}' \
http://localhost:4031/operations/register-zip-download
{"json":null,"meta":{"values":["undefined"]}
In logs I see
[Server] POST /operations/start-generating-new-app 200 167.700 ms - 47
[Server] [15-3-2024 10:43:48] Checking for pending apps
[Server] [15-3-2024 10:43:48] Failing stale generations
[Server] [15-3-2024 10:43:50] Generating app
[Server] [15-3-2024 10:43:50] Checking for pending apps
[Server] [15-3-2024 10:43:52] Generating app
[Server] POST /operations/get-app-generation-result 200 6.021 ms - 398
[Server] [15-3-2024 10:44:8] Checking for pending apps
[Server] [15-3-2024 10:44:10] Failing stale generations
[Server] [15-3-2024 10:45:8] Failing stale generations
[Server] [15-3-2024 10:45:8] Checking for pending apps
[Server] [15-3-2024 10:46:8] Checking for pending apps
[Server] [15-3-2024 10:46:8] Failing stale generations
[Server] [15-3-2024 10:47:8] Checking for pending apps
[Server] [15-3-2024 10:47:8] Failing stale generations
[Server] [15-3-2024 10:48:8] Failing stale generations
[Server] [15-3-2024 10:48:8] Checking for pending apps
[Server] [15-3-2024 10:49:8] Checking for pending apps
[Server] [15-3-2024 10:49:8] Failing stale generations
[Server] [15-3-2024 10:50:8] Checking for pending apps
[Server] [15-3-2024 10:50:8] Failing stale generations
[Server] POST /operations/get-app-generation-result 200 4.549 ms - 398
[Server] [15-3-2024 10:51:8] Checking for pending apps
[Server] [15-3-2024 10:51:8] Failing stale generations
[Server] POST /operations/register-zip-download 200 52.611 ms - 45
[Server] [15-3-2024 10:52:8] Checking for pending apps
[Server] [15-3-2024 10:52:8] Failing stale generations
Done
I need a reimplementation of this app https://usemage.ai/ https://github.com/wasp-lang/wasp/tree/wasp-ai/wasp-ai
I need an app that will provide an endpoint that takes:
This app should not be secured in any way. It will work inside container and will not be exposed.