PeanutDumplings
PeanutDumplings
XXata
Created by PeanutDumplings on 7/1/2024 in #help
Xata issues with environment variables in NestJS
I'm still confused how this error is even occuring at that point, because chronologically in the logs it goes:
[1:25:01 pm] Starting compilation in watch mode...

[1:25:04 pm] Found 0 errors. Watching for file changes.

xau_****** (api key)
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [NestFactory] Starting Nest application...
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] ConfigHostModule dependencies initialized +7ms
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] ConfigModule dependencies initialized +1ms
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] ImageModule dependencies initialized +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RoutesResolver] AppController {/}: +124ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RoutesResolver] ImageController {/image}: +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/image/:id, GET} route +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/image, POST} route +1ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/image, DELETE} route +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [NestApplication] Nest application successfully started +1ms

xata api key error, same as in original post
[1:25:01 pm] Starting compilation in watch mode...

[1:25:04 pm] Found 0 errors. Watching for file changes.

xau_****** (api key)
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [NestFactory] Starting Nest application...
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] ConfigHostModule dependencies initialized +7ms
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] ConfigModule dependencies initialized +1ms
[Nest] 2484 - 02/07/2024, 1:25:04 pm LOG [InstanceLoader] ImageModule dependencies initialized +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RoutesResolver] AppController {/}: +124ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RoutesResolver] ImageController {/image}: +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/image/:id, GET} route +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/image, POST} route +1ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [RouterExplorer] Mapped {/image, DELETE} route +0ms
[Nest] 2484 - 02/07/2024, 1:25:05 pm LOG [NestApplication] Nest application successfully started +1ms

xata api key error, same as in original post
5 replies
XXata
Created by PeanutDumplings on 7/1/2024 in #help
Xata issues with environment variables in NestJS
This didn't seem to work In my app.module.ts file, as per the docs, I checked that my code matched the doc's code (which is did)
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ImageModule } from './image/image.module';
import { ConfigModule } from '@nestjs/config';

@Module({
controllers: [AppController],
providers: [AppService],
imports: [ConfigModule.forRoot(), ImageModule],
})
export class AppModule {}
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ImageModule } from './image/image.module';
import { ConfigModule } from '@nestjs/config';

@Module({
controllers: [AppController],
providers: [AppService],
imports: [ConfigModule.forRoot(), ImageModule],
})
export class AppModule {}
as well as manually passing the api key, changing this
async init() {
const records = await getXataClient().db.uploads.select(['slug']).getAll();
records.forEach((rec) => {
if (rec && typeof rec.slug === 'string') {
this.cache.add(rec.slug);
}
});
}
async init() {
const records = await getXataClient().db.uploads.select(['slug']).getAll();
records.forEach((rec) => {
if (rec && typeof rec.slug === 'string') {
this.cache.add(rec.slug);
}
});
}
to this
async init() {
const xata = new XataClient({ apiKey: process.env.XATA_API_KEY });
const records = await xata.db.uploads.select(['slug']).getAll();
records.forEach((rec) => {
if (rec && typeof rec.slug === 'string') {
this.cache.add(rec.slug);
}
});
}
async init() {
const xata = new XataClient({ apiKey: process.env.XATA_API_KEY });
const records = await xata.db.uploads.select(['slug']).getAll();
records.forEach((rec) => {
if (rec && typeof rec.slug === 'string') {
this.cache.add(rec.slug);
}
});
}
5 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
Thanks :hapi:
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
Any update on this?
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
Thanks, that worked.
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
5.0.4
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"target": "ES6",
"outDir": "./dist",
"resolveJsonModule": true,
"skipLibCheck": true
},
"include": ["src/**/*"]
}
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"target": "ES6",
"outDir": "./dist",
"resolveJsonModule": true,
"skipLibCheck": true
},
"include": ["src/**/*"]
}
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
I'm just using plain ts, and using nodemon currently to run the native typescript code (as it wont compile with that issue), and it is windows
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
I even ran xata init --force to re-init the project, which yet again didn't work
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
The path ../../xata is correct and finds the src/xata.ts file. I've ran xata codegen again, which updated the tables array (with the new table that I created), but still I get the same errors
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Property db doesn't exist on XataClient
This is because when I made an initial query to create some data It returned the same error
17 replies
XXata
Created by PeanutDumplings on 4/11/2023 in #help
Can't install xata cli
Yeah that worked great. Thanks a bunch!
6 replies