r/adonisjs • • Sep 21 '26

Beginner Coder: Stuck with an error

Hi,

Currently developing a basic web app following adonisjs docs.

I've ran into an error:

[23:18:41.975\1 ERROR (12316): Cannot transform undefined value. Use "this.whenLoaded (value)" to allow undefined values

My project is on github:

https://github.com/Ajaz754/adonisjs-project-22-/ tree/main

The error is pointing to 'app/transformers/ post__transformer.ts' Line 13

I've followed adonis docs completely step by step except for ?.depth(2) on line 14, which when I removed only introduced more errors along with this one.

Also VS Code isn't flagging the error. Only when I go to my browser and visit local host the error appears in powershell and my browser. Any help would be much appreciated

2 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/Capable_Square7319 Sep 22 '26

Yep, set the 'post.author' to optional and added 'this.whenLoaded' in my post transformer and that did the trick. Thanks alot pal, been stuck on that error for a while now, really appreciate the help