You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to set up a project with angular 19.1.1 and aws-client@6.12.1.
The set up works fine in classic Angular style.
After installing Native Federation and running the schematics the app builds (certain packages need to be skipped in federation.config.js to do so)
The following errors show up in the browser and the app does not start.
As I am not sure if this is a Native federation or Amplify problem a duplicate issue has been posted to the native federation team.
For reference package.json and federation.config.js will be appended at the end of the issue.
Different configurations have given other messages. Our suspicis is that the Amplify singleton is not correctly shared between other classes that need it.
Certain error messages were about making a call before calling Amplify.configure() which was not the case as we could always recover the config via Amplify.getConfig() before the calls in question and it was present,
Hello, @tsapasMi33 and thanks for opening this issue. It looks like you have a duplicate dependency for @aws-amplify/core in your package.json (possibly after upgrading from v5 or a lower version). Can you please remove this and see if it resolves the issue?
@tsapasMi33, thank you for linking the associated issues and providing a sample repo! I haven't personally used Native Federation so I'll look into this a follow up after trying to reproduce this locally.
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
GraphQL API, REST API, Authentication
Amplify Version
v6
Amplify Categories
No response
Backend
Other
Environment information
Describe the bug
We are trying to set up a project with angular 19.1.1 and aws-client@6.12.1.
The set up works fine in classic Angular style.
After installing Native Federation and running the schematics the app builds (certain packages need to be skipped in federation.config.js to do so)
The following errors show up in the browser and the app does not start.
As I am not sure if this is a Native federation or Amplify problem a duplicate issue has been posted to the native federation team.
For reference package.json and federation.config.js will be appended at the end of the issue.
Different configurations have given other messages. Our suspicis is that the Amplify singleton is not correctly shared between other classes that need it.
Certain error messages were about making a call before calling Amplify.configure() which was not the case as we could always recover the config via Amplify.getConfig() before the calls in question and it was present,
Expected behavior
Work out-of-the-box as in microfront-end example in https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/create-amplify-micro-frontend-portal.html (Module Federation used in example)
Reproduction steps
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
function amplifyInitializer(): void {
Amplify.configure(
{
API: {
GraphQL: {
endpoint: getEndpoint(),
region: 'eu-west-3',
defaultAuthMode: 'oidc',
},
REST: {
api: {
endpoint: 'https://**********.execute-api.eu-west-3.amazonaws.com/v1',
region: 'eu-west-3',
},
},
},
},
{
API: {
GraphQL: {
headers: async () => {
return {
Authorization: 'Bearer ' + sessionStorage.getItem('access_token'),
host: 'fpl3kbwtxzdklbivpdsmk6uuru.appsync-api.eu-west-3.amazonaws.com',
};
},
},
REST: {
headers: async () => {
return {
'X-Api-Key': '*******kC1j',
Authorization: 'Bearer ' + sessionStorage.getItem('access_token'),
};
},
},
},
Auth: {
tokenProvider: new CustomTokenProvider(),
},
}
);
}
class CustomTokenProvider implements TokenProvider {
async getTokens(): Promise<AuthTokens | null> {
const accessToken = sessionStorage.getItem('access_token');
if (!accessToken) {
return null;
}
}
private decodeJWT(token: string): Record<string, string> {
try {
const payload = token.split('.')[1];
return JSON.parse(atob(payload));
} catch (e) {
console.error(e);
return {};
}
}
}
function getEndpoint() {
return
https://cloudfront.***********.com/graphql?header=${btoa( JSON.stringify({ host: 'fpl3***************.appsync-api.eu-west-3.amazonaws.com', Authorization: 'Bearer ' + (sessionStorage.getItem('access_token') ?? ''), }) )}&payload=e30=
;}
this method is called inside a a provideAppInitializer in app.config.ts
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: