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
So here in our company, we're trying to integrate the Jira App to validate ticket numbers.
But we don't have much experience in NodeJs and AWS Amplify
What we've done, in the file src/components/Requests/Requests.js we add this block
`async function getJiraApiToken(secretName) {
try {
// Retrieve the secret from AWS Secrets Manager
const secret_name = "token";
const client = new SecretsManagerClient({
region: "sa-east-1",
});
let response;
response = await client.send(
new GetSecretValueCommand({
SecretId: secret_name,
VersionStage: "AWSCURRENT", // VersionStage defaults to AWSCURRENT if unspecified
})
);
const secret = response.SecretString
return secret;
} catch (error) {
// For a list of exceptions thrown, see
// https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html
throw error;
}
}
async function getJiraIssue(issueKey) {
try {
// Fetch the API token from AWS Secrets Manager
const apiToken = await getJiraApiToken('token'); // Replace with your actual secret name
// Authentication credentials (username and API token from Secrets Manager)
const email = '[email protected]';
// Create an auth header using email and API token
const auth = {
username: email,
password: apiToken
};`
But we receive the error to get credentials
Request.js:100 Error retrieving secret from AWS Secrets Manager: CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
We try to add a sts function to force a role use, with no success
`2024-11-21T18:27:20.226Z [INFO]: Module not found: Error: Can't resolve 'path' in '/codebuild/output/src390236463/src/team-idc/node_modules/@aws-amplify/backend/lib/engine/validations'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }`
Can you help us understand where we are going wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Guys,
I hope everyone is doing well.
So here in our company, we're trying to integrate the Jira App to validate ticket numbers.
But we don't have much experience in NodeJs and AWS Amplify
What we've done, in the file src/components/Requests/Requests.js we add this block
`async function getJiraApiToken(secretName) {
try {
// Retrieve the secret from AWS Secrets Manager
const secret_name = "token";
const client = new SecretsManagerClient({
region: "sa-east-1",
});
let response;
response = await client.send(
new GetSecretValueCommand({
SecretId: secret_name,
VersionStage: "AWSCURRENT", // VersionStage defaults to AWSCURRENT if unspecified
})
);
const secret = response.SecretString
return secret;
} catch (error) {
// For a list of exceptions thrown, see
// https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html
throw error;
}
}
async function getJiraIssue(issueKey) {
try {
// Fetch the API token from AWS Secrets Manager
const apiToken = await getJiraApiToken('token'); // Replace with your actual secret name
But we receive the error to get credentials
Request.js:100 Error retrieving secret from AWS Secrets Manager: CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
We try to add a sts function to force a role use, with no success
`const { STSClient, AssumeRoleCommand } = require('@aws-sdk/client-sts');
async function getSecretsClient() {
const stsClient = new STSClient({ region: 'source-region' });
const assumeRoleResponse = await stsClient.send(
new AssumeRoleCommand({
RoleArn: 'arn:aws:iam::target-account-id:role/role-name',
RoleSessionName: 'YourSessionName',
})
);
return new SecretsManagerClient({
region: 'target-region',
credentials: {
accessKeyId: assumeRoleResponse.Credentials.AccessKeyId,
secretAccessKey: assumeRoleResponse.Credentials.SecretAccessKey,
sessionToken: assumeRoleResponse.Credentials.SessionToken,
},
});
}`
ALSO, we tried to use the Secret from Amplify, like this example: https://docs.amplify.aws/javascript/deploy-and-host/fullstack-branching/secrets-and-vars/
But the we receive this error
`2024-11-21T18:27:20.226Z [INFO]: Module not found: Error: Can't resolve 'path' in '/codebuild/output/src390236463/src/team-idc/node_modules/@aws-amplify/backend/lib/engine/validations'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }`
Can you help us understand where we are going wrong?
Beta Was this translation helpful? Give feedback.
All reactions