Assets.getTextAsync is not a function?

In version 2 I used:

const csp_string = Assets.getText('csp.json')

For version 3 I’m using, as per the v3 docs:

const csp_string = await Assets.getTextAsync('csp.json')

I’m getting the error:

Uncaught TypeError: Assets.getTextAsync is not a function

What am I missing?

Are you calling it on the server?

I’ve run into the same issue — it seems that getText still works but now returns a promise so you can just await its return value.

3 Likes

In which version exactly are you testing this? getTextAsync should exist… Can you provide a reproduction?

I’m using 3.0 rc1 – here’s a repo that reproduces the issue: GitHub - brianlukoff/gettext-repro

In server/main.js, Assets.getText works as an async function but Assets.getTextAsync is not found.

I see the issue now!

We didn’t update the names of these methods for the apps.

This PR fixes this, and it will be available in the next RC (which should still be released this week).

2 Likes

This should be fixed now in version 3.0-rc.2!

3 Likes

Fantastic – thanks!