コンテンツにスキップ

ソースマップとスタックトレース

ベータ

Stack traces help with debugging your code when your application encounters an unhandled exception. Stack traces show you the specific functions that were called, in what order, from which line and file, and with what arguments.

Most JavaScript code is first bundled, often transpiled, and then minified before being deployed to production. This process creates smaller bundles to optimize performance and converts code from Typescript to Javascript if needed.

Source maps translate compiled and minified code back to the original code that you wrote. Source maps are combined with the stack trace returned by the JavaScript runtime to present you with a stack trace.

ソースマップ

ソースマップを有効にするには、wrangler pages deploy--upload-source-mapsフラグを提供するか、Pagesアプリケーションのwrangler.tomlファイルに以下を追加します(Pagesビルド環境を使用している場合):

upload_source_maps = true

ソースマップのアップロードが有効になると、Wranglerはwrangler pages deployを実行したときに自動的にソースマップファイルを生成してアップロードします。

スタックトレース

​​ アプリケーションが未捕捉の例外をスローすると、ソースマップを取得し、例外のスタックトレースをアプリケーションの元のソースコードの行にマッピングします。

その後、リアルタイムログをストリーミングする際にスタックトレースを表示できます。

関連リソース