Coder Social home page Coder Social logo

`DatabaseName must begin with a letter and contain only alphanumeric characters.` error in Function + Posgres + Drizzle ORM setup about ion HOT 8 CLOSED

frixaco avatar frixaco commented on August 18, 2024
`DatabaseName must begin with a letter and contain only alphanumeric characters.` error in Function + Posgres + Drizzle ORM setup

from ion.

Comments (8)

frixaco avatar frixaco commented on August 18, 2024

Maybe it's a linking issue? Running pnpm db:gen gives following error:

❯ pnpm db:gen --verbose

> test-sst-ion@ db:gen /Users/frixaco/personal/test-sst-ion
> AWS_PROFILE=default sst shell drizzle-kit generate:pg "--verbose"

time=2024-03-24T19:41:43.422+05:00 level=INFO msg="checking for bun" path="/Users/frixaco/Library/Application Support/sst/bin/bun"
time=2024-03-24T19:41:43.422+05:00 level=INFO msg="initializing project" version=0.0.197
time=2024-03-24T19:41:43.423+05:00 level=INFO msg="esbuild building"
time=2024-03-24T19:41:43.425+05:00 level=INFO msg="esbuild built" outfile=/Users/frixaco/personal/test-sst-ion/.sst/eval/eval-1711291303423.mjs
time=2024-03-24T19:41:43.425+05:00 level=INFO msg="evaluating config"
time=2024-03-24T19:41:43.451+05:00 level=INFO msg="config evaluated"
time=2024-03-24T19:41:43.451+05:00 level=INFO msg="checking platform"
time=2024-03-24T19:41:43.452+05:00 level=INFO msg="credentials found"
time=2024-03-24T19:41:43.452+05:00 level=INFO msg="fetching bootstrap"
time=2024-03-24T19:41:45.026+05:00 level=INFO msg="found existing bootstrap" data="{\"version\":1,\"asset\":\"sst-asset-runmwdcehbtz\",\"state\":\"sst-state-runmwdcehbtz\"}"
time=2024-03-24T19:41:45.027+05:00 level=INFO msg="loaded config" app=test-sst-ion stage=frixaco
time=2024-03-24T19:41:45.027+05:00 level=INFO msg="INFO getting data key=link app=test-sst-ion stage=frixaco"
drizzle-kit: v0.20.14
drizzle-orm: v0.30.4

No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/frixaco/personal/test-sst-ion/drizzle.config.ts'
Error: "TestSSTDatabase" is not linked
    at Object.get (/Users/frixaco/personal/test-sst-ion/node_modules/.pnpm/[email protected]/node_modules/sst/dist/resource.js:15:15)
    at Object.<anonymous> (/Users/frixaco/personal/test-sst-ion/database.ts:19:22)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._compile (/Users/frixaco/personal/test-sst-ion/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:8644:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.newLoader [as .ts] (/Users/frixaco/personal/test-sst-ion/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:8648:13)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)

from ion.

fwang avatar fwang commented on August 18, 2024

@frixaco what's the name of the app defined in sst.config.ts?

from ion.

frixaco avatar frixaco commented on August 18, 2024

@fwang Thanks for a response. I'm not sure I understand what do you mean by "app". If you are asking about whether it's a Next.js/Remix app, then no. It's just a Function linked to a database (wanted to make bundling migration files with lambda handler work in a Function).

Let me know if you need more details.

from ion.

thdxr avatar thdxr commented on August 18, 2024

we mean what's at the top of your sst.config.ts, the part you cut out

when you don't specify a default database name to the postgres component we use the app name as the database name, seems like yours is not valid

from ion.

frixaco avatar frixaco commented on August 18, 2024

@thdxr Thanks for clarifying.
It is test-sst-ion 🤦‍♂️ , it is using the name of root project directory. Sorry, that's my bad for being a bit careless, didn't realize that.
Maybe Ion can auto "fix" the app name when running sst init? (I'm down to implement it, though I haven't looked at the source code yet)

from ion.

thdxr avatar thdxr commented on August 18, 2024

oh can database names not have hyphens? @fwang should we strip them?

from ion.

jayair avatar jayair commented on August 18, 2024

Gonna assign to Frank

from ion.

fwang avatar fwang commented on August 18, 2024

Fixed in 0.0.226

Hyphens will be replaced by underscores, which are allowed for Postgres database names.

from ion.

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.