#✅ Using getUrl from the aws-amplify/storage throws NoCredentials but fetchAuthSession shows them

3 messages · Page 1 of 1 (latest)

low temple
#

HI there.
I'm trying to build something with amplify gen2. It's been running smoothly up until i deployed my app that is getting a URL for one of my pictures in my S3 bucket. Note that this does work locally.
Once deployed my app tells my i have empty credentials.

Yes, I am indeed unauthenticated but my amplify app should accept this. I have indeed unauthenticated access allowed on my bucket, I have my generated unauthenticated roles that seem to have all necessary permissions. I do fetch my credentials and I can see them in my console when logging them. When I try to trigger the "getUrl" function, it doesn't even fire any request. It just blocks locally. Has anyone ever been through such a situation ?

Is there anything I can show you guys to help ?

Feeling kind of lost here.

Thanks in advance.

low temple
#

Update 1:

I juste realised my Amplify.getConfig() would return an empty object in my context. This is obviously the source of the problem. The question is now: Why?

low temple
#

Fixed:

For all people who would stumble uppon the same issue, here's my fix:

Resent updates have brought some new ways to monorepos (like NX, in my case) to build the code. Basically, even though amplify should be a singleton, several instances could be created while building a monorepo that calls amplify in multiple packages. That is exactly what was happening to me.

Setting amplify up in a shared repo and calling every amplpify action from that repo fixed my problem.

Cheers.