GithubHelp home page GithubHelp logo

Comments (11)

tolumide-ng avatar tolumide-ng commented on May 22, 2024 37

Sorry, newbie to primeCMS here. I'm getting this error and not exactly sure on the steps to fix it. Any thoughts? Thanks

You need to create the extension uuid_ossp on the database you're using:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

from prime.

agustif avatar agustif commented on May 22, 2024 3

I've been implementing this in a separated typeorm project, with an external dependency uuid and using @BeforeInsert from typeorm when creating the Entity.

just as an fyi, in case it helps you patch this temporarily, not suggesting not to use postgres add-on.

import { Entity, PrimaryColumn, Column, BeforeInsert, BaseEntity } from 'typeorm';
import { v4 } from 'uuid';
import * as bcrypt from 'bcryptjs';

@Entity('users')
export class User extends BaseEntity {
	@PrimaryColumn('uuid') id: string;

	@Column('varchar', { length: 255 })
	firstName: string;

	@Column('varchar', { length: 255 })
	lastName: string;

	@Column('text') email: string;

	@Column('text') password: string;

	@Column('boolean', { default: false })
	confirmed: boolean;

	@BeforeInsert()
	addId() {
		this.id = v4();
	}
	async hashPassword() {
		this.password = await bcrypt.hash(this.password, 10);
	}
}

from prime.

tupizz avatar tupizz commented on May 22, 2024 3

@tolumide-ng why i have to run this command? Pg dont have natively this?

from prime.

birkir avatar birkir commented on May 22, 2024 1

Both circleci and heroku install this by default. I would say it's almost mandatory to have uuid support in postgres today. TypeORM will attempt to enable the extension on start.

Are you guys running on windows maybe? I am all for fixing platform issues.

from prime.

chriskolenko avatar chriskolenko commented on May 22, 2024 1

Upgrading typeorm and also passing on the extra settings from the ENV db connection string. Can give this a crack in a couple days time.

from prime.

chriskolenko avatar chriskolenko commented on May 22, 2024

Oh.. and typeorm needs to be upgraded.

from prime.

chriskolenko avatar chriskolenko commented on May 22, 2024

Looks like pgcrypto extension isn't 100%

    {
        "message": "null value in column \"id\" violates not-null constraint",
        "locations": [{
            "line": 2,
            "column": 3
        }],
        "path": ["onboard"],
        "extensions": {
            "code": "INTERNAL_SERVER_ERROR",
            "exception": {
                "message": "null value in column \"id\" violates not-null constraint",
                "name": "QueryFailedError",
                "length": 204,
                "severity": "ERROR",
                "code": "23502",
                "detail": "Failing row contains (null, viper@..., f, null).",
                "schema": "public",
                "table": "user_email",
                "column": "id",
                "file": "execMain.c",
                "line": "2017",
                "routine": "ExecConstraints",
                "query": "INSERT INTO \"user_email\"(\"id\", \"address\", \"verified\", \"userId\") VALUES (DEFAULT, $1, $2, DEFAULT) RETURNING \"id\", \"verified\"",
                "parameters": ["viper@....", 0]
            }
        }
    }

EDIT:
Ignore above.. I created the DB schema with an older version of the application. I was doing some bad things which got me into that state.

Everything is working good with pgcrypto.

from prime.

chriskolenko avatar chriskolenko commented on May 22, 2024

I'm using the stable helm chart and install postgres on kubernetes.

The maintainers have refused to install this deprecated plugin. Which has forced TypeORM to implement a fix. Which was merged a few weeks back.

from prime.

chriskolenko avatar chriskolenko commented on May 22, 2024

Would you except a PR to fix?

from prime.

birkir avatar birkir commented on May 22, 2024

Absolutely! Is it a matter of just upgrading typeorm?

from prime.

chroline avatar chroline commented on May 22, 2024

Sorry, newbie to primeCMS here. I'm getting this error and not exactly sure on the steps to fix it. Any thoughts? Thanks

from prime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.