Feature(s) impacted
Unable to create actions for new collections.
agent.customizeCollection('reports', collection => {... }
Observed behavior
My local environment has migrations that haven’t been pushed to my production Supabase. One of these migrations contains my “reports” table. When I try to add an action on this collection I get errors in the logs, see below.
Am I missing something? Do I need to push my supabase changes to prod for the collections to become available? I would like to fully test these out on local incase I need to change my migrations.
Expected behavior
I should be able to create actions for collections that exist on my Development environment (local).
Failure Logs
⠋ Updating typingsinfo: Starting agent locally…
✖ Collection 'reports' not found. List of available collections: chat_sessions, communities, community_channel_membership, community_channel_messages, community_channels, community_class_schedule, community_classes, community_members, community_message_reactions, community_requests, connection_requests, event_chat, event_messages, event_waitlist, events, events_users, message_reactions, messages, news_posts, notifications, profiles, user_tokens
ERROR: "forestadmin:update-typings" exited with 1.
Context
- Project name: Train with Us
- Team name: Train With Us
- Environment name: Development | alexrafuse
- Database type: Supabase
- Recent changes made on your end if any: None
Hello @Stacked and welcome to the community !
When developing locally, you should have had to fill the datasources.js file with a connection string to your development database.
On which you will need to run your migrations, then starting the agent locally with the
dev:watch command you should be able to start with no issues.
Could you share a bit more detail on how you set up the connection string, and on which command do you experience this error ?
Best regards,
My connection string is set to my local database:
/**
* @returns {Record<string, { connectionOptions: (import('@forestadmin/datasource-sql').ConnectionOptions | import('@forestadmin/datasource-mongo').ConnectionParams); datasourceSuffix?: string; }>}
*/
module.exports = () => ({
main: {
connectionOptions: {
uri: "postgresql://postgres:postgres@127.0.0.1:54322/postgres",
},
},
})
I run my migrations, then npm run dev:watch which works, but as soon as I save my modifications to my index.ts file with my actions, I get these errors:
nodemon] restarting due to changes...
[nodemon] starting `npm run dev`
> cloud-customizer@1.0.0 dev
> npm run build:node && forest-cloud start
> cloud-customizer@1.0.0 forestadmin:update-typings
> forest-cloud update-typings
> cloud-customizer@1.0.0 build:node
> node esbuild.mjs
dist/code-customizations/index.js 3.5kb
⚡ Done in 6ms
info: Starting agent locally…
⠴ Updating typingserror: Failed to load constraints on relation on table 'profiles' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'images' referencing 'objects.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'images' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'blocked_users' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'blocked_users' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'reports' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'reports' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'report_actions' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'suspensions' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'suspensions' referencing 'users.id'. The relation will be ignored.
error: Failed to load constraints on relation on table 'safety_rate_limits' referencing 'users.id'. The relation will be ignored.
⠦ Updating typingswarning: Skipping relation "profiles.profiles_through_connection_requests" because of error: You have used the alias profiles_through_connection_requests in two separate associations. Aliased associations must have unique aliases.
✖ Collection 'reports' not found. List of available collections: chat_sessions, communities, community_channel_membership, community_channel_messages, community_channels, community_class_schedule, community_classes, community_members, community_message_reactions, community_requests, connection_requests, event_chat, event_messages, event_waitlist, events, events_users, message_reactions, messages, news_posts, notifications, profiles, user_tokens
ERROR: "forestadmin:update-typings" exited with 1.
info: Schema was not updated since last run (hash: 44a266b8e55ab53b5d3ec164d0da4ae8249db9b4)
info: Successfully mounted on Standalone server (http://0.0.0.0:3351)
Thanks for the details, I can confirm this is not the expected behaviour. I will keep you updated when we have a fix on the way.
1 Like
Sorry for the late reply, I have not yet been able to start working on a fix, but as to not impede on your development, as a workaround you can delete the nodemon.json file, which will also be part of the final fix
I’ll work on a fix ASAP, thanks for your patience.
1 Like
Hello @Stacked
The fix is now available on @forestadmin/forest-cloud v1.12.57, which should be imported as latest in your package.json, please make sure to install the latest version.
With this new version, the locally running agent will be responsible of updating the typings.d.ts file, ensuring that it represents the local development environment. The nodemon.json config file has also been removed, please delete this file if you didn’t yet.
I will await your confirmation to mark this thread as resolved,
Best regards,