Astro Info
Astro v4.5.16
Node v18.18.0
System Linux (x64)
Package Manager unknown
Output static
Adapter none
Integrations astro:db
@astrojs/db/file-url
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I prefer to set srcDir: '.' to avoid an extra directory level. However, when using Astro DB, seeding will fail with the following error:
00:13:11 [ERROR] [astro:db] Cannot read properties of undefined (reading 'Symbol(drizzle:Columns)')
As mentioned in #10458 (comment), if I unset srcDir and move the seed file (seed.ts, along with the entire db folder) outside of src, seeding will succeed.
I digged in the code and found if I change it to return resolved.virtual even if the seed file is inside srcDir, the seeding will succeed as well, without "recursive seed calls" as mentioned in the comments. This may have unexpected consequences though since I'm not familiar with the internals.
|
if (importer.id.startsWith(srcDirPath)) { |
|
// Seed only if the importer is in the src directory. |
|
// Otherwise, we may get recursive seed calls (ex. import from db/seed.ts). |
|
return resolved.seedVirtual; |
|
} |
|
return resolved.virtual; |
What's the expected result?
Seeding should success whether the seed file is under srcDir or not.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-tx22uf
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I prefer to set
srcDir: '.'to avoid an extra directory level. However, when using Astro DB, seeding will fail with the following error:As mentioned in #10458 (comment), if I unset
srcDirand move the seed file (seed.ts, along with the entiredbfolder) outside ofsrc, seeding will succeed.I digged in the code and found if I change it to return
resolved.virtualeven if the seed file is insidesrcDir, the seeding will succeed as well, without "recursive seed calls" as mentioned in the comments. This may have unexpected consequences though since I'm not familiar with the internals.astro/packages/db/src/core/integration/vite-plugin-db.ts
Lines 57 to 62 in ecb4435
What's the expected result?
Seeding should success whether the seed file is under
srcDiror not.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-tx22uf
Participation