Describe the bug
When a profile has no profile picture, the API returns photo_url === null, and it triggers this error:
Invalid Full profile response: Invalid value null supplied to : ({ id: number, name: string, handle: string, photo_url: string } & Partial<{ bio: string }>)/0: { id: number, name: string, handle: string, photo_url: string }/photo_url: string
Uncaught:
Error: Failed to get own profile: Invalid Full profile response: Invalid value null supplied to : ({ id: number, name: string, handle: string, photo_url: string } & Partial<{ bio: string }>)/0: { id: number, name: string, handle: string, photo_url: string }/photo_url: string
at SubstackClient.ownProfile (/.../node_modules/.pnpm/substack-api@2.2.1/node_modules/substack-api/dist/index.js:1510:19)
To Reproduce
Steps to reproduce the behavior:
- Create a new account and set up its profile
- Use the account's cookie to initialize a
client
await client.ownProfile()
- See error
Expected behavior
Return a profile with photo_url of null or '' (note: null means changing the profile definition, right now it is always a string).
Describe the bug
When a profile has no profile picture, the API returns
photo_url === null, and it triggers this error:To Reproduce
Steps to reproduce the behavior:
clientawait client.ownProfile()Expected behavior
Return a profile with
photo_urlofnullor''(note:nullmeans changing the profile definition, right now it is always a string).