/* * © 2024 Snyk Limited * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FailedToGenerateCommitStatusError = exports.InvalidThirdPartyCredentialsError = exports.FailedToDetectIssuesError = exports.MergeConflictError = exports.FailedToFetchMergeCommitShaError = exports.FailedToCompleteTestError = exports.FailedDeterminingProjectTargetError = exports.OutOfSyncError = exports.ThirdPartyRateLimitError = exports.ManifestNotFoundError = exports.FailedToReadManifestError = void 0; const types_1 = require("../types"); const problem_error_1 = require("../problem-error"); /** * @class * @name FailedToReadManifestError * @description Snyk failed to read 1 or more manifest files. * Sometimes things go wrong: a flaky connection, 3rd party services go down and Snyk is unable to read the files needed in order to test your project. * * If this happens, you could try: * * - Opening and re-opening your Pull Request / Merge Request, to kick off a new test * - Removing and re-adding the repo to Snyk * * Ultimately, you should contact support@snyk.io if the issue persists * * See more: * - [https://support.snyk.io/s/article/Failed-to-read-manifest-file---Commit-Status](https://support.snyk.io/s/article/Failed-to-read-manifest-file---Commit-Status) * @summary Error reading manifest * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FailedToReadManifestError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Error reading manifest', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0001', status: 500, description: `Snyk failed to read 1 or more manifest files. Sometimes things go wrong: a flaky connection, 3rd party services go down and Snyk is unable to read the files needed in order to test your project. If this happens, you could try: - Opening and re-opening your Pull Request / Merge Request, to kick off a new test - Removing and re-adding the repo to Snyk Ultimately, you should contact support@snyk.io if the issue persists`, errorCode: 'SNYK-PR-CHECK-0001', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [ 'https://support.snyk.io/s/article/Failed-to-read-manifest-file---Commit-Status', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FailedToReadManifestError = FailedToReadManifestError; /** * @class * @name ManifestNotFoundError * @description Snyk uses your project manifest file to analyze your projects for vulnerabilities. When you import a project for monitoring, Snyk scans the project to locate the manifest file and then remembers where that file is. * When a project manifest file is moved or deleted, we still try to look for in it in the last known location in order to run tests on commit statuses. If we can't find the file, this error can occur. * * If this happens, you could try the following: * 1. Delete the matching project from your account in the Snyk app (UI or CLI). * 2. Now import the same project from scratch. * * As during the original import, Snyk scans the project and locates the manifest file. * * See more: * - [https://support.snyk.io/s/article/Manifest-not-found](https://support.snyk.io/s/article/Manifest-not-found) * @summary Manifest not found * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class ManifestNotFoundError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Manifest not found', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0002', status: 404, description: `Snyk uses your project manifest file to analyze your projects for vulnerabilities. When you import a project for monitoring, Snyk scans the project to locate the manifest file and then remembers where that file is. When a project manifest file is moved or deleted, we still try to look for in it in the last known location in order to run tests on commit statuses. If we can't find the file, this error can occur. If this happens, you could try the following: 1. Delete the matching project from your account in the Snyk app (UI or CLI). 2. Now import the same project from scratch. As during the original import, Snyk scans the project and locates the manifest file.`, errorCode: 'SNYK-PR-CHECK-0002', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [ 'https://support.snyk.io/s/article/Manifest-not-found', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.ManifestNotFoundError = ManifestNotFoundError; /** * @class * @name ThirdPartyRateLimitError * @description Snyk makes requests to your SCM when testing a project, in order to analyze your projects for vulnerabilities. If we need to make a lot of requests in a short time period, we may encounter third party rate limits, and this error can occur. * * If you receive any of these errors, try re-running the tests, by closing and reopening the pull request. * @summary Rate limit hit while testing project * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class ThirdPartyRateLimitError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Rate limit hit while testing project', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0003', status: 429, description: `Snyk makes requests to your SCM when testing a project, in order to analyze your projects for vulnerabilities. If we need to make a lot of requests in a short time period, we may encounter third party rate limits, and this error can occur. If you receive any of these errors, try re-running the tests, by closing and reopening the pull request.`, errorCode: 'SNYK-PR-CHECK-0003', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.ThirdPartyRateLimitError = ThirdPartyRateLimitError; /** * @class * @name OutOfSyncError * @description Sometimes a project may become out of sync between the lockfile and the manifest file. This might happen if the package.json is modified or updated but the lockfile is not. * * This can be resolved by ensuring the lockfile and manifest file are correctly synced, by executing npm install or yarn install. * * In some cases, it may be necessary to delete the node_modules folder and the package-lock.json and run npm install again to force a full reinstall. * * See more: * - [https://support.snyk.io/s/article/Out-of-sync-manifest--lockfile-in-the-project](https://support.snyk.io/s/article/Out-of-sync-manifest--lockfile-in-the-project) * @summary Out of Sync Error * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class OutOfSyncError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Out of Sync Error', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0004', status: 422, description: `Sometimes a project may become out of sync between the lockfile and the manifest file. This might happen if the package.json is modified or updated but the lockfile is not. This can be resolved by ensuring the lockfile and manifest file are correctly synced, by executing npm install or yarn install. In some cases, it may be necessary to delete the node_modules folder and the package-lock.json and run npm install again to force a full reinstall. `, errorCode: 'SNYK-PR-CHECK-0004', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [ 'https://support.snyk.io/s/article/Out-of-sync-manifest--lockfile-in-the-project', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.OutOfSyncError = OutOfSyncError; /** * @class * @name FailedDeterminingProjectTargetError * @description An internal error occurred, whereby Snyk was unable to determine the correct target for a given project in your PR Check. * * If you receive this error, try re-running the tests, by closing and reopening the pull request. * * Ultimately, you should contact support@snyk.io if the issue persists. * @summary Failed determining project target * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FailedDeterminingProjectTargetError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Failed determining project target', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0005', status: 500, description: `An internal error occurred, whereby Snyk was unable to determine the correct target for a given project in your PR Check. If you receive this error, try re-running the tests, by closing and reopening the pull request. Ultimately, you should contact support@snyk.io if the issue persists.`, errorCode: 'SNYK-PR-CHECK-0005', level: 'error', classification: types_1.Classification.UNEXPECTED, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FailedDeterminingProjectTargetError = FailedDeterminingProjectTargetError; /** * @class * @name FailedToCompleteTestError * @description A "Failed to complete testing check status" appears in your commit checks when an unknown error occurs while Snyk was trying to test your projects for vulnerabilities or license issues. * * If you receive this error, try re-running the tests, by closing and reopening the pull request. * * Ultimately, you should contact support@snyk.io if the issue persists. * * See more: * - [https://support.snyk.io/s/article/Unknown-PR-test-error](https://support.snyk.io/s/article/Unknown-PR-test-error) * @summary Failed to complete the test * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FailedToCompleteTestError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Failed to complete the test', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0006', status: 500, description: `A "Failed to complete testing check status" appears in your commit checks when an unknown error occurs while Snyk was trying to test your projects for vulnerabilities or license issues. If you receive this error, try re-running the tests, by closing and reopening the pull request. Ultimately, you should contact support@snyk.io if the issue persists.`, errorCode: 'SNYK-PR-CHECK-0006', level: 'error', classification: types_1.Classification.UNEXPECTED, instance, }, details, Object.assign({ links: [ 'https://support.snyk.io/s/article/Unknown-PR-test-error', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FailedToCompleteTestError = FailedToCompleteTestError; /** * @class * @name FailedToFetchMergeCommitShaError * @description In order for snyk test to run, we need the merge commit SHA from the GitHub. For some reason, we couldn’t get it. * * Try closing and then reopening the pull request, or you can Skip the Pull Request Check if it is consistent. * @summary Failed to fetch merge commit SHA * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FailedToFetchMergeCommitShaError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Failed to fetch merge commit SHA', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0007', status: 500, description: `In order for snyk test to run, we need the merge commit SHA from the GitHub. For some reason, we couldn’t get it. Try closing and then reopening the pull request, or you can Skip the Pull Request Check if it is consistent.`, errorCode: 'SNYK-PR-CHECK-0007', level: 'error', classification: types_1.Classification.UNEXPECTED, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FailedToFetchMergeCommitShaError = FailedToFetchMergeCommitShaError; /** * @class * @name MergeConflictError * @description Merge Conflict Error is not a Snyk specific issue but rather some issues on your SCM environment. As an example, merge conflicts could happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file. * * To resolve this, you might need to figure out all the merge conflicts on your SCM environment and resolve them to fully remediate these types of errors on Snyk. As a note, this cannot be modified/changed on Snyk's side. * * See more: * - [https://support.snyk.io/s/article/Merge-conflict-error](https://support.snyk.io/s/article/Merge-conflict-error) * @summary Merge conflict error * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class MergeConflictError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Merge conflict error', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0008', status: 422, description: `Merge Conflict Error is not a Snyk specific issue but rather some issues on your SCM environment. As an example, merge conflicts could happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file. To resolve this, you might need to figure out all the merge conflicts on your SCM environment and resolve them to fully remediate these types of errors on Snyk. As a note, this cannot be modified/changed on Snyk's side.`, errorCode: 'SNYK-PR-CHECK-0008', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [ 'https://support.snyk.io/s/article/Merge-conflict-error', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.MergeConflictError = MergeConflictError; /** * @class * @name FailedToDetectIssuesError * @description Snyk is always trying to check for new issues and vulnerabilities to keep you safe. We do so by testing on your code on webhook Pull Request events and Push events. * * Occasionally you might see a "Failed to detect issues" commit status which may block your PR. This means that we tried to run a test against your changes but unfortunately something went wrong / we encountered an internal problem. If this happens to you try recreating the pull request and if it still occurs reach out and let us know which user, organization and project and commit sha you experienced the issue with on support@snyk.io * * See more: * - [https://support.snyk.io/s/article/Failed-to-detect-issues](https://support.snyk.io/s/article/Failed-to-detect-issues) * @summary Failed to detect issues * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FailedToDetectIssuesError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Failed to detect issues', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0009', status: 500, description: `Snyk is always trying to check for new issues and vulnerabilities to keep you safe. We do so by testing on your code on webhook Pull Request events and Push events. Occasionally you might see a "Failed to detect issues" commit status which may block your PR. This means that we tried to run a test against your changes but unfortunately something went wrong / we encountered an internal problem. If this happens to you try recreating the pull request and if it still occurs reach out and let us know which user, organization and project and commit sha you experienced the issue with on support@snyk.io`, errorCode: 'SNYK-PR-CHECK-0009', level: 'error', classification: types_1.Classification.UNEXPECTED, instance, }, details, Object.assign({ links: [ 'https://support.snyk.io/s/article/Failed-to-detect-issues', ] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FailedToDetectIssuesError = FailedToDetectIssuesError; /** * @class * @name InvalidThirdPartyCredentialsError * @description Snyk uses credentials configured on your integration to test your code and to update your PR Check. * * If this error occurs, please ensure your integration and credentials are correctly set up, by following the instructions for your SCM here: https://docs.snyk.io/integrate-with-snyk/git-repository-scm-integrations * @summary No valid credentials to process PR check * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class InvalidThirdPartyCredentialsError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'No valid credentials to process PR check', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0010', status: 401, description: `Snyk uses credentials configured on your integration to test your code and to update your PR Check. If this error occurs, please ensure your integration and credentials are correctly set up, by following the instructions for your SCM here: https://docs.snyk.io/integrate-with-snyk/git-repository-scm-integrations`, errorCode: 'SNYK-PR-CHECK-0010', level: 'error', classification: types_1.Classification.ACTIONABLE, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.InvalidThirdPartyCredentialsError = InvalidThirdPartyCredentialsError; /** * @class * @name FailedToGenerateCommitStatusError * @description Snyk is always trying to check for new issues and vulnerabilities to keep you safe. We do so by testing on your code on webhook Pull Request events and Push events. * * Occasionally you might see a "Failed to generate a commit status" which may block your PR. This means that we tried to run a test against your changes but unfortunately something went wrong / we encountered an internal problem. If this happens to you try recreating the pull request and if it still occurs reach out and let us know which user, organization and project and commit sha you experienced the issue with on support@snyk.io * @summary Failed to generate a commit status * @category PRChecks * @param {string} details the specific details that causes this error * @param {string} description the general description for this error * @param {Classification} classification the error classification determining if the error is user-actionable or not * @param {Record} [additionalData] a collection of relevant data specific to this error * @param {Error} [cause] the `Error` type that caused this error to be thrown * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata */ class FailedToGenerateCommitStatusError extends problem_error_1.ProblemError { constructor(details, additionalData, cause, instance, logs) { super({ title: 'Failed to generate a commit status', type: 'https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-pr-check-0011', status: 500, description: `Snyk is always trying to check for new issues and vulnerabilities to keep you safe. We do so by testing on your code on webhook Pull Request events and Push events. Occasionally you might see a "Failed to generate a commit status" which may block your PR. This means that we tried to run a test against your changes but unfortunately something went wrong / we encountered an internal problem. If this happens to you try recreating the pull request and if it still occurs reach out and let us know which user, organization and project and commit sha you experienced the issue with on support@snyk.io`, errorCode: 'SNYK-PR-CHECK-0011', level: 'error', classification: types_1.Classification.UNEXPECTED, instance, }, details, Object.assign({ links: [] }, additionalData), cause, logs); this.name = this.constructor.name; } } exports.FailedToGenerateCommitStatusError = FailedToGenerateCommitStatusError; //# sourceMappingURL=PRChecks-error-catalog.js.map