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

Failure deployment digital ocean #3167

Open
johnygold opened this issue Oct 27, 2024 · 6 comments
Open

Failure deployment digital ocean #3167

johnygold opened this issue Oct 27, 2024 · 6 comments
Labels
type: bug 🐛 Something isn't working

Comments

@johnygold
Copy link

Followed the steps on: https://docs.vendure.io/guides/deployment/deploy-to-digital-ocean-app-platform/

Error comes from the vendure-worker deployment.

4-10-27 17:39:01] │ -----> Build
[2024-10-27 17:39:01] │ Running build
[2024-10-27 17:39:01] │
[2024-10-27 17:39:01] │ > [email protected] build
[2024-10-27 17:39:01] │ > tsc
[2024-10-27 17:39:01] │
[2024-10-27 17:39:02] │ src/vendure-config.ts(74,21): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
[2024-10-27 17:39:02] │ Type 'undefined' is not assignable to type 'string'.
[2024-10-27 17:39:02] │ src/vendure-config.ts(75,21): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
[2024-10-27 17:39:02] │ Type 'undefined' is not assignable to type 'string'.
[2024-10-27 17:39:02] │

it is referring to the env vars. These were added globally according to the documentation.

    AssetServerPlugin.init({
        route: 'assets',
        assetUploadDir: process.env.ASSET_UPLOAD_DIR || path.join(__dirname, '../static/assets'),
        // If the MINIO_ENDPOINT environment variable is set, we'll use
        // Minio as the asset storage provider. Otherwise, we'll use the
        // default local provider.
        storageStrategyFactory: process.env.MINIO_ENDPOINT ?  configureS3AssetStorage({
            bucket: 'vendure-assets',
            credentials: {
                accessKeyId: process.env.MINIO_ACCESS_KEY, //line 74
                secretAccessKey: process.env.MINIO_SECRET_KEY, //line75
            },
            nativeS3Configuration: {
                endpoint: process.env.MINIO_ENDPOINT,
                forcePathStyle: true,
                signatureVersion: 'v4',
                // The `region` is required by the AWS SDK even when using MinIO,
                // so we just use a dummy value here.
                region: 'eu-west-1',
            },
        }) : undefined,
    }),
@johnygold johnygold added the type: bug 🐛 Something isn't working label Oct 27, 2024
@oidt
Copy link
Contributor

oidt commented Oct 27, 2024

did you also configured the s3 storage? MINIO_ENDPOINT
looks like it is needed to run and probably a mistake to say otherwise use default

@johnygold
Copy link
Author

I created a Spaces Object storage. In the env vars i put in the name. Or should I put in the wholue url https://[NAME].ams3.digitaloceanspaces.com ? I can upload files from the DigitalOcean interface there. But since it's referring also to amazon I am a bit confused. I have not linked an AWS S3 bucket to this. Must I do this to make it work?

@oidt
Copy link
Contributor

oidt commented Oct 28, 2024

MINIO_ENDPOINT needs to be there, is it? With the https://xxx part indeed because it is the endpoint to connect to.
the library that is used in most node projects is from AWS S3, it works on almost all S3 storage providers.

@michaelbromley
Copy link
Member

This is probably due to the fact that by default, TypeScript types any env var as string | undefined. So there are 2 solutions:

  1. Add the missing MINIO_ env var definitions to the environment.d.ts file that is shipped with a standard installation
  2. assert the types directly in your config file: accessKeyId: process.env.MINIO_ACCESS_KEY as string

@johnygold
Copy link
Author

johnygold commented Nov 3, 2024

Directly inserting the minio parameters indeed bypasses this error. However the next obstacle has to do with the database when trying to deploy. Relation administrator does not exist it seems.

info 11/3/24, 3:49 PM - [RoutesResolver] HealthController {/health}:
[ddshop] [2024-11-03 15:49:21] info 11/3/24, 3:49 PM - [RouterExplorer] Mapped {/health, GET} route
[ddshop] [2024-11-03 15:49:21] error 11/3/24, 3:49 PM - [TypeORM] Query error: SELECT "Administrator"."createdAt" AS "Administrator_createdAt", "Administrator"."updatedAt" AS "Administrator_updatedAt", "Administrator"."deletedAt" AS "Administrator_deletedAt", "Administrator"."firstName" AS "Administrator_firstName", "Administrator"."lastName" AS "Administrator_lastName", "Administrator"."emailAddress" AS "Administrator_emailAddress", "Administrator"."id" AS "Administrator_id", "Administrator"."userId" AS "Administrator_userId" FROM "administrator" "Administrator"
[ddshop] [2024-11-03 15:49:21] warn 11/3/24, 3:49 PM - [Vendure Server] Awaiting DB schema creation... (attempt 0)
[ddshop] [2024-11-03 15:49:21] error 11/3/24, 3:49 PM - [TypeORM] Query error: SELECT "Administrator"."createdAt" AS "Administrator_createdAt", "Administrator"."updatedAt" AS "Administrator_updatedAt", "Administrator"."deletedAt" AS "Administrator_deletedAt", "Administrator"."firstName" AS "Administrator_firstName", "Administrator"."lastName" AS "Administrator_lastName", "Administrator"."emailAddress" AS "Administrator_emailAddress", "Administrator"."id" AS "Administrator_id", "Administrator"."userId" AS "Administrator_userId" FROM "administrator" "Administrator"
[ddshop] [2024-11-03 15:49:21] warn 11/3/24, 3:49 PM - [Vendure Server] Awaiting DB schema creation... (attempt 1)

lots attempts...

[ddshop] [2024-11-03 15:49:23] warn 11/3/24, 3:49 PM - [Vendure Server] Awaiting DB schema creation... (attempt 18)
[ddshop] [2024-11-03 15:49:23] error 11/3/24, 3:49 PM - [TypeORM] Query error: SELECT "Administrator"."createdAt" AS "Administrator_createdAt", "Administrator"."updatedAt" AS "Administrator_updatedAt", "Administrator"."deletedAt" AS "Administrator_deletedAt", "Administrator"."firstName" AS "Administrator_firstName", "Administrator"."lastName" AS "Administrator_lastName", "Administrator"."emailAddress" AS "Administrator_emailAddress", "Administrator"."id" AS "Administrator_id", "Administrator"."userId" AS "Administrator_userId" FROM "administrator" "Administrator"
[ddshop] [2024-11-03 15:49:23] error 11/3/24, 3:49 PM - [Vendure Server] Timed out when awaiting the DB schema to be ready!

@johnygold
Copy link
Author

I get this also when deploying on railway:
2024-11-03 16:55:43.071 UTC [97] ERROR: relation "administrator" does not exist at character 460

2024-11-03 16:55:43.071 UTC [97] STATEMENT: SELECT "Administrator"."createdAt" AS "Administrator_createdAt", "Administrator"."updatedAt" AS "Administrator_updatedAt", "Administrator"."deletedAt" AS "Administrator_deletedAt", "Administrator"."firstName" AS "Administrator_firstName", "Administrator"."lastName" AS "Administrator_lastName", "Administrator"."emailAddress" AS "Administrator_emailAddress", "Administrator"."id" AS "Administrator_id", "Administrator"."userId" AS "Administrator_userId" FROM "administrator" "Administrator"

2024-11-03 16:55:43.103 UTC [97] ERROR: relation "zone" does not exist at character 1416

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants